实例代码“Ctrl+/”提示“F11/ESC”全屏 返回 格式化 恢复 运行
x
 
1
<!DOCTYPE html>
2
<html>
3
<body>
4
5
<p id="demo">Click the button to display the array values after the split.</p>
6
7
<button onclick="myFunction()">Try it</button>
8
9
<script>
10
function myFunction()
11
{
12
var str="a,b,c,d,e,f";
13
var n=str.split(",");
14
document.getElementById("demo").innerHTML=n[0];
15
}
16
</script>
17
18
19
</body>
20
</html>
21
22
23