本文介绍了javascript警报不起作用....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
亲爱的专家, 我已经陷入了我的asp项目......
Dear Experts, I have stuck in my asp project......
<html xmlns="www.w3/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警报不起作用....
发布评论