Home > Article > Web Front-end > javascript function
parseInt:
var val2 = parseInt(document.getelementbyid("val2").value);
string:
js gets the string:
1) Get the string before/after the specified character
var str_before = string.split (str)[0];
var str_after = string.split(str)[1];
2) Get the character at the specified position in the string
str1 = str.charAt(0);
3) Intercept the specified string to Specify the content between strings
var a ='I am...';
var index1=a.indexOf("中");
var index2=a.indexOf("what");
alert(a. substring(index1,index2));
Traverse objects:
for(var p in person){
alter(person[p]);
}