Home  >  Article  >  Web Front-end  >  javascript function

javascript function

巴扎黑
巴扎黑Original
2016-12-06 09:59:231415browse

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]);
}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn