javascript警报不起作用....

编程入门 行业动态 更新时间:2024-10-27 22:32:08
本文介绍了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警报不起作用....

本文发布于:2023-11-27 20:27:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1639488.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:警报   不起作用   javascript

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!