<html>
<head>
 <tilte></title>
 <script type="text/JavaScript">
       function showHello()
       var count=parseInt(document.getElementById("txtCount").value);
       for (var i=0;i<count;i++)
       {
          document.write("Hello World");
}
</script>
</head>
<body>
     请输入要显示的Hello World的次数:<input type="text" id="txtCount"/><br/>
     <input type="button" onclick="showHello()" value="点击显示吧" />
</body>
</html>

解决方案 »

  1.   

    函数少了大括号:
    function showHello()
    {
           var count=parseInt(document.getElementById("txtCount").value);
           for (var i=0;i<count;i++)
           {
              document.write("Hello World");
           }
    }
      

  2.   


    //花括号没有闭合,还有个中文逗号
    function showHello() {
        var count = parseInt(document.getElementById("txtCount").value);
        for (var i = 0; i < count; i++) {
            document.write("Hello World");
        }
    }
      

  3.   

    还有,在循环中使用document.write()方法输出是有问题的,建议使用DOM操作,或者在循环体中拼接字符串,然后在函数中输出。write()方法的使用限制,建议你自己google一下,这要涉及到文档流的概念。
      

  4.   


    <html>
    <head>
     <tilte>dgdsg</title>
    <script type="text/javascript">
    function dotest(){
      var value = document.getElementById("txtCount").value;
      for(var i=0;i<value;i++){
      
        alert("输入数据");
      
    }
    }
    </script>
    </head>
    <body>     请输入要显示的Hello World的次数:<input type="text" id="txtCount"/><br/>
         <input type="button" onclick="dotest()" value="点击显示吧" />
    </body>
    </html>
    绝对可以执行出  你想要的结果  我试过了