if语句中的javascript消息框 [英] javascript messagebox in if statement
本文介绍了if语句中的javascript消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我收到了这段代码,而我的问题是javascript无法加载
Hi,
I got this code and my problem the javascript doesnt load
if (projectID != "0")
{
Response.Redirect("ProjectDetails.aspx");
}
if (projectID == "0")
{
Response.Write("<script>alert('Please Select')</script>");
}
推荐答案
我相信问题出在您的脚本标记中.您需要将语言指定为javascript.您还需要在JavaScript行的末尾添加分号.结果应如下所示(忽略javascript中的双引号-这是CP编辑器中的一个错误,我无法解决):
I believe the issue is in your script tag. You need to specify the language as javascript. You also need to put a semicolon at the end of your javascript line. The result should look like this (ignore the double-quotes around javascript - it is a bug in the CP editor that I can''t get around):
if (projectID != "0")
{
Response.Redirect("ProjectDetails.aspx");
}
if (projectID == "0")
{
Response.Write("<script language='javascript'>alert('Please Select');</script>");
}
这是带有更多信息和帮助的MSDN问题:
http://forums.asp.net/t/1051178.aspx/1 [ ^ ]
Here is a MSDN question with more information and help:
http://forums.asp.net/t/1051178.aspx/1[^]
试试这个:
Hi,
Try this:
if (projectID != "0")
{
Response.Redirect("ProjectDetails.aspx");
}
if (projectID == "0")
{
Response.Write("<script language='javascript'>alert('Please Select');</script>");
}
--Amit
--Amit
这篇关于if语句中的javascript消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文