标签:
indexOf()的用法:返回字符中indexof(string)中字串string在父串中首次出现的位置,从0开始!没有返回-1;方便判断和截取字符串!
<script type="text/javascript">
var str="Hello world!";
document.write(str.indexOf("Hello") + "<br />");
document.write(str.indexOf("World") + "<br />");
document.write(str.indexOf("world"));
</script>
以上代码的输出:
0 -1 6
标签:
原文地址:http://www.cnblogs.com/JAYIT/p/5396198.html