为了账号安全,请及时绑定邮箱和手机立即绑定

<!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow(){ var aa; aa=prompt('确定打开吗');

为甚,没反应

正在回答

4 回答

function openWindow()

            { 

                var aa; 

                aa=prompt("确定打开吗?");

            }

openWindow();    //你少了这个语句,是调用的


0 回复 有任何疑惑可以回复我~

你只是定义了函数而没有调用,所以没反应 !!

function openWindow()

            { 

                var aa; 

                aa=prompt("确定打开吗?");

            }

openWindow();    //这个是调用方法是语句

0 回复 有任何疑惑可以回复我~

 <script type="text/javascript"> 

  function openWindow(){ 

  var aa; 

  aa=prompt("dfdfd")

  }

  openWindow();

  </script>

//这个是有反应的 ,你可以试试

0 回复 有任何疑惑可以回复我~
<!DOCTYPE html> 
<html> 
    <head> 
        <title> new document </title> 
        <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> 
        <script type="text/javascript"> 
            function openWindow()
            { 
                var aa; 
                aa=prompt("确定打开吗?");
            }
            openWindow();
        </script>
    </head>
</html>

你定义了函数不调用,怎么会有反应。。。还有html基本的结构不能少吧。。。

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
JavaScript入门篇
  • 参与学习       741624    人
  • 解答问题       9869    个

JavaScript做为一名Web工程师的必备技术,本教程让您快速入门

进入课程

本课相似问答

5 回答&lt;html&gt; &lt;head&gt; &lt;title&gt; ll&lt;/title&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot;&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gbk&quot;/&gt; &lt;script type=&quot;text/javascript&quot;&gt; function openwindow(){var open=confirm(&quot;确定打开这个

1 回答&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; new document &lt;/title&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gbk&quot;/&gt; &lt;script type=&quot;text/javascript&quot;&gt; function openWindow() { var open=confirm(&quot;确认新建窗口打开网站吗?&quot;);

1 回答&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; new document &lt;/title&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gbk&quot;/&gt; &lt;script type=&quot;text/javascript&quot;&gt; function rec(){ var message=cofirm(&quot;是否打开窗口?&quot;); if(message

3 回答&lt;!DOCTYPE HTML&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt; &lt;title&gt;display&lt;/title&gt; &lt;script type=&quot;text/javascript&quot;&gt; var i=0; function hidetext(){ i++; if(i%2!=0){

2 回答&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt; new document &lt;/title&gt; &lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gbk&quot;/&gt; &lt;script type=&quot;text/javascript&quot;&gt; // 新窗口打开时弹出确认框,是否打开 // 通过输入对话框,确定打开的网址,默认为 http://www.imooc.com/

搜索更多本课相关问答

<!DOCTYPE html> <html> <head> <title> new document </title> <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> <script type="text/javascript"> function openWindow(){ var aa; aa=prompt('确定打开吗');

我要回答 关注问题
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号