菜鸟教程在线测试网址:
JQuery 分割字符串
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>菜鸟教程(runoob.com)</title>
<script src="http://cdn.staticfile.org/jquery/2.0.0/jquery.min.js">
</script>
<script>
$(document).ready(function(){
$("button").click(function(){
var arr = \'google,***,JavaWorld\';
var strArray = arr.split(\',\');
for(var i in strArray){
alert(strArray[i]);
}
});
});
</script>
</head>
<body>
<h3></h3>
<button>点我</button>
</body>
</html>
内容版权声明:除非注明,否则皆为本站原创文章。