javascript警报不起作用.... [英] javascript alert is not working....

查看:72
本文介绍了javascript警报不起作用....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的专家,





我已经陷入了我的asp.net项目......





Dear Experts,


I have stuck in my asp.net project......


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <script type='text/javascript'>

    $(document).ready(function () {

        $("#myhref").on("click", function (e) {

        alert("Hello world - Alert");
        document.write('Hello World!');

    });

});

</script>

</head>
<body>
    <form id="form1" runat="server">
    <div>

    Welcome to my Site..

      <a href="#" id="myhref">Add to cart</a>



    </div>
    </form>
</body>
</html>







以上代码有什么问题.....



当我点击href链接..但它没有被解雇任何提醒.......

请帮助我..



谢谢....




Is there any problem with the above code.....

When i click the href link.. but it is not fired any alert.......
please help me..

Thanks....

推荐答案

document )。ready( function (){
(document).ready(function () {


#myhref)。on( click function (e){

alert( Hello world - Alert);
document .write(' Hello World! );

});

});

< / script >

< / head >
< 正文 >
< 表单 id = form1 runat = 服务器 >
< div >

欢迎访问我的网站..

< a href = id = myhref > 加入购物车< ; / a >



< / div >
< / form >
< / body > ;
< / html >
("#myhref").on("click", function (e) { alert("Hello world - Alert"); document.write('Hello World!'); }); }); </script> </head> <body> <form id="form1" runat="server"> <div> Welcome to my Site.. <a href="#" id="myhref">Add to cart</a> </div> </form> </body> </html>







以上代码有什么问题.....



当我点击href链接..但它没有被解雇任何提醒.......

请帮助我..



谢谢....




Is there any problem with the above code.....

When i click the href link.. but it is not fired any alert.......
please help me..

Thanks....


你没有链接Jquery JS文件



You have not linked Jquery JS file

<head runat="server">
    <script src="JavaScript/jquery-1.6.1.min.js" type="text/javascript"></script>
</head>


这篇关于javascript警报不起作用....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆