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

为什么alert 没有弹出1啊??????????

为什么alert 没有弹出1啊??????????

慕粉3430898 2016-12-25 15:22:56
<!DOCTYPE html><html><head>    <meta  http-equiv="content-type" content="text/html"  charset="UTF-8">    <title>lightBox</title>    <script type="text/javascript" src= "jQuery.js" > </script>    <script type="text/javascript" src= "demo.js" > </script>    <link rel="stylesheet" href="bas.css" type="text/css">    <link rel="stylesheet" href="box.css" type="text/css"></head><body><!--遮罩层--><div id="lightbox-max"></div><!--弹出层--><div id="lightbox-poput">    <div>        <span class="lightbox-btn lightbox-btn-show"></span>        <img src="2-2.jpg" width="100%">        <span class="light-next-btn lightbox-next-btn-show"></span>    </div>    <div>        <div>            <p>标题:非铁</p>        <span>索引:0027</span>        </div>        <div></div>    </div></div><script>    $(function(){        var Light=new lightBox();    });</script></body></html;(function($){    alert(1);    var lightBox=function(){        alert(2);    };    lightBox.prototype={    };    window["lightBox"]=lightBox;})(jQuery);为什么alert  没有弹出1啊??????????
查看完整描述

4 回答

?
MarlboroKay

TA贡献189条经验 获得超236个赞

你没有调用啊,他怎么执行。
查看完整回答
3 反对 回复 2016-12-25
?
习惯受伤

TA贡献885条经验 获得超1144个赞

后边html标签闭合不全
查看完整回答
1 反对 回复 2016-12-25
?
慕粉1103124771

TA贡献16条经验 获得超1个赞


//img1.sycdn.imooc.com//58608ff60001954903650274.jpghtml没有关闭,你这个代码应该会报错的啊

查看完整回答
反对 回复 2016-12-26
?
慕侠4409898

TA贡献2条经验 获得超0个赞

html没有正确闭合,书写的js代码一定要放到script标签中

查看完整回答
反对 回复 2016-12-26
?
隔壁老伍丶

TA贡献15条经验 获得超6个赞

<!DOCTYPE html>
<html>
<head>
    <meta  http-equiv="content-type" content="text/html"  charset="UTF-8">
    <title>lightBox</title>

    <script type="text/javascript" src= "jQuery.js" > </script>
    <script type="text/javascript" src= "demo.js" > </script>


    <link rel="stylesheet" href="bas.css" type="text/css">
    <link rel="stylesheet" href="box.css" type="text/css">


</head>
<body>
<!--遮罩层-->
<div id="lightbox-max"></div>
<!--弹出层-->
<div id="lightbox-poput">
    <div>
        <span class="lightbox-btn lightbox-btn-show"></span>
        <img src="2-2.jpg" width="100%">
        <span class="light-next-btn lightbox-next-btn-show"></span>
    </div>
    <div>
        <div>
            <p>标题:非铁</p>
        <span>索引:0027</span>
        </div>
        <div></div>
    </div>
</div>

<script>
    $(function(){
        var Light=new lightBox();
    });
    
    ;(function($){
        alert(1);
        var lightBox=function(){
            alert(2);
        };
        lightBox.prototype={
    
        };
        window["lightBox"]=lightBox;
    })(jQuery);
</script>
</body>
</html>


查看完整回答
反对 回复 2016-12-25
?
慕数据5775487

TA贡献76条经验 获得超19个赞

不知道你把代码放在script标签外是什么意思,它怎么能执行,//img1.sycdn.imooc.com//585f7cc60001a7c402140148.jpg

查看完整回答
反对 回复 2016-12-25
?
这鸡汤有毒

TA贡献1条经验 获得超0个赞

</html 后面少一个> 可能是的
查看完整回答
反对 回复 2016-12-25
  • 4 回答
  • 0 关注
  • 1886 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
意见反馈 帮助中心 APP下载
官方微信