初学者问题,OnClientClick调用vbscript过程的简单的问题。
为什么网页会有错误!无法弹出msgbox!
<script language="vbscript" type ="text/vbscript" >
function Test()
MsgBox ("one two")
End function
</script><html >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnTest" runat="Server" Text="Test" OnClientClick="Test()" Visible="True" />
</div>
</form>
</body>
</html>这样却可以弹出窗口!<script language="javascript" type ="text/javascript" >
function Test(){
alert('Do you want to subscribe the thread?');
}
</script><html >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnTest" runat="Server" Text="Test" OnClientClick="Test()" Visible="True" />
</div>
</form>
</body>
</html>谢谢!请详细说一下,我好困扰!
为什么网页会有错误!无法弹出msgbox!
<script language="vbscript" type ="text/vbscript" >
function Test()
MsgBox ("one two")
End function
</script><html >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnTest" runat="Server" Text="Test" OnClientClick="Test()" Visible="True" />
</div>
</form>
</body>
</html>这样却可以弹出窗口!<script language="javascript" type ="text/javascript" >
function Test(){
alert('Do you want to subscribe the thread?');
}
</script><html >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnTest" runat="Server" Text="Test" OnClientClick="Test()" Visible="True" />
</div>
</form>
</body>
</html>谢谢!请详细说一下,我好困扰!
解决方案 »
- !!!!这个正则还真的挺纠结的!!!!!
- 已经做好网页了 下来怎么发布到网上。大侠们指导下
- 求最简单方法判断checkboxlist中有多少items被选择?
- GridView取值
- 无刷新的三级联动实现(开发方式不变无需书写脚本)
- 求:VS2005中文正式版的下载地址
- 抢分 Session["UserName"]和User.Identity.Name比较,讨论拿分
- 请求:如何打开MDF格式的文件?
- 在.net的form中,如何实现按enter键则提交数据,我试过简单在form中写入button无法实现的
- C#怎样写一个传递二维数组的方法呢?
- 怎样配置NHibernate?
- [关于个性化profile] 在自己建的数据库中怎么不自动配置profile ???
function Test()
return MsgBox ("one two")
end function
行22 字符7 错误语句未结束 代码0 url:http//localhost:1031/website1/lx.aspx
下面是页面代码<script language="vbscript" type ="text/vbscript" >
function Test()
return MsgBox ("one two")
end function
</script><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml" >
<head><title>
无标题页
</title></head>
<body>
<form name="form1" method="post" action="lx.aspx" id="form1">
<div>
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTY3NzE5MjIyMGRkRukqIRyjX8QWIm0o/kBwS4K9CDc=" />
</div> <div>
<input type="submit" name="btnTest" value="Test" onclick="Test();" id="btnTest" />
</div>
<div> <input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="/wEWAgK4vLnjBwK14deQBZlCNEM0A1ema0BC18I7EUIXaTk6" />
</div></form>
</body>
</html>
function Test()
return MsgBox ("one two")
end function
</script>
<asp:Button runat="server" ID="aa" OnClientClick="javascript:Test()" Text="aaa" />
alert对话框 可以弹出
我想知道为什么
谢谢
End Sub
sub show()
MsgBox "欢迎阁下光临"
end sub
</script>
<input type="button" value="确定" onclick="vbs:show()">
CutBug的可以
谢谢
上面解释了,asp.net生成的代码都是javascript语法。你记得总是使用这个语法来调用vbscript函数就没有问题了。