在vbscript中的onclick事件有几种说明方法?

Xdickens 2001-07-21 06:19:00
我用的object_onclick这样的方法好似不行的..



如果用<SCRIPT LANGUAGE="VBScript" EVENT="OnClick" FOR="Submit">这样的方法就可以,为什么?
...全文
343 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
boysun 2001-07-21
  • 打赏
  • 举报
回复
实例一:
<html>
<head>
<title>一个简单的例子</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="VBScript">
<!--
private sub cbocolor_OnClick()
select case frmColor.cbocolor.value
case "黑色"
document.bgcolor=vbBlack
case "红色"
document.bgcolor=vbBlue
case "绿色"
document.bgcolor=vbGreen
case "兰色"
document.bgcolor=vbRed
case "黄色"
document.bgcolor=rgb(0,255,255)
end select
end sub

-->
</script>
</head>

<body bgcolor="#009900" text="#990033">
<p align="center">一个简单的例子</p>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../image/012.gif" width="207" height="145"></td>
<td align="center">这是一个VBscript的简单例子,用来改变主页的背景颜色,你只要在菜单中选定颜色既可。
<form name="frmcolor" method="post" action="">
<select name="cbocolor">
<option value="绿色" selected>绿色</option>
<option value="黑色">黑色</option>
<option value="黄色">黄色</option>
<option value="红色">红色</option>
<option value="兰色">兰色</option>
</select>
</form>

</td>
<td><img src="../image/015.jpg" width="207" height="145"></td>
</tr>
</table>
</body>
</html>
实例二:
<html>
<head>
<title>使用内联事件控制器</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#009900" text="#990033">
<p align="center">在HTML文档中插入VBScript脚本语言程序的方法之一<br>使用内联事件控制器</p>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../image/012.gif" width="207" height="145"></td>
<td align="center">这是一个VBscript的简单例子,点按按钮时会弹出一个消息框。
<form>
<input name="cmdOk" type="Button" value="Click Me" onClick=' MsgBox"OK!!!" ' language="VBScript">
</form>

</td>
<td><img src="../image/015.jpg" width="207" height="145"></td>
</tr>
</table>
</body>
</html>
实例三:
<html>
<head>
<title>使用内联事件控制器</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="VBScript" for="cmdOk" event="onClick">
<!--
MsgBox"OK!!!"
MsgBox"Hello!!!"
-->
</script>

</head>

<body bgcolor="#009900" text="#990033">
<p align="center">在HTML文档中插入VBScript脚本语言程序的方法之一<br>使用For/Event属性</p>
<table width="98%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><img src="../image/012.gif" width="207" height="145"></td>
<td align="center">这是一个VBscript的简单例子,点按按钮时会弹出两个消息框。
<form>
<input name="cmdOk" type="Button" value="Click Me">
</form>

</td>
<td><img src="../image/015.jpg" width="207" height="145"></td>
</tr>
</table>
</body>
</html>
我知道的就这么多。你自己看好了。
hydnoahark 2001-07-21
  • 打赏
  • 举报
回复
>>我用的object_onclick这样的方法好似不行的

这个只有IE支持,object是一个对象的ID

28,390

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧