使用javascript在asp.net中的确认框 [英] confirmation box in asp.net using javascript

查看:58
本文介绍了使用javascript在asp.net中的确认框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


i试图确认是否添加更多记录而无法运行代码



请找到我的脚本

hi
i tried to get confirmation whether to add more records or not and unable to run the code

Please find my script

Response.Write("<Script>if(confirm('Data updated Any more data you add ??')) "+ txtdescription.Text ="" +" ;else ;</Script>");



请指导这个


Please guide on this

推荐答案

查看这篇文章



使用&调用RegisterStartUpScript,RegisterClientScript和Client-Side Script [ ^ ]


您的代码甚至不会编译,因为您有一个等号,应该有一个加号。使用适当的括号来减少错误的风险也是值得的。



以下对我来说没问题:



Your code won't even compile as you have an equals sign where there should be a plus sign. It's also worth using the proper brackets with this sort of thing to reduce the risk of errors.

The following works fine for me:

String doSomething = "alert('true');";

Response.Write("<Script>if(confirm('Data updated Any more data you add ??')){ " + doSomething + "}else{alert('false');}</Script>");


这篇关于使用javascript在asp.net中的确认框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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