js involves utility functions

*, js regular removal of html tags and empty characters such as empty lines

function removeHTMLTag(str) {
     str = str.replace(/<\/?[^>]*>/g,''); //去除HTML tag
     str = str.replace(/[ | ]*\n/g,'\n'); //Remove trailing blanks
     str = str.replace(/\n[\s| | ]*\r/g,'\n'); //Remove extra blank lines
     str = str.replace(/ /ig,'');//Remove (case insensitive)
     return str;
}
PS: It needs to be studied in depth! ! ! !
Time: January 6, 2017 16:20:02

 

*, when getting the value of the form custom attribute in js

var value = this.getAttrbute(custom attribute name);

 

*. The method of js to get the currency format of the number is available for personal testing

//Get the data and convert it to a number with comma format
	function getFmtNumForHtml(xTemp) {
		if(xTemp == null || xTemp == '') {
			xTemp = "0.00";
		}
	    num = xTemp.toString().replace(/\$|\,/,'');    
	    if(isNaN(num))    
	    num = "0";    
	    sign = (num == (num = Math.abs(num)));    
	    num = Math.floor(num*100+0.50000000001);    
	    cents = num%100;    
	    num = Math.floor(num/100).toString();    
	    if(cents<10)    
	    cents = "0" + cents;    
	    for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)    
	    num = num.substring(0,num.length-(4*i+3))+','+    
	    num.substring(num.length-(4*i+3));    
	    return (((sign)?'':'-') + num + '.' + cents);    
	}

 

-------------------------------------------------- -----------source------------------------------------- ---------------------

*, Article 1

http://www.jb51.net/article/37306.htm

 

*, Article 3

http://blog.csdn.net/fengqingtao2008/article/details/46273469

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=327001330&siteId=291194637