夜蝶翱翔
2016-12-28 23:02
谢谢帮助我的同学们!
俩问题,首先少个),还有就是如果你想找空格符,应该是“ ”,而不是“”,用我下面的能行
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>string对象</title>
<script type="text/javascript">
var mystr="Hello World!"
document.write(mystr.substring(mystr.indexOf("W"),mystr.length) + "<br />");
document.write(mystr.substring(1,mystr.indexOf(" ",0)));
</script>
</head>
<body>
</body>
</html>
document.write(mystr.substring(1,mystr.indexOf("",0));
这段结尾缺了‘)’,导致结果输不出来
输出第二行少了“)”
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>string对象</title>
<script type="text/javascript">
var mystr="Hello World!"
document.write(mystr.substring(mystr.indexOf("W"),mystr.length) + "<br />");
document.write(mystr.substring(1,mystr.indexOf("",0)));
</script>
</head>
<body>
</body>
</html>
JavaScript进阶篇
468190 学习 · 21891 问题
相似问题