为什么VBSCRIPT不执行?

来源:百度知道 编辑:UC知道 时间:2024/06/08 02:44:20
详细程序如下
<% @language="vbscript" codepage="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/htm14/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>q_vbs</title>
<script language="vbScript">
<!--

option explicit
dim name
dim age
dim tips(4)
tips(0)="努力学习,坚持不懈"
tips(1)="尊师重教,以人为本"
tips(2)="十年树木,百年树人"
tips(3)="书读百遍,其义自现"
tips(4)="海纳百川,有容乃大"
const defaultname="佚名"
const defaultage="20"

sub givethemsg
if age<15 then
msgbox name & "小朋友,你好!"
exit sub
end if
if a

应该是你这里缺少事件吧(我这里修改成了onkeypress()事件)
~ 另外 你的自定义函数也有问题 没有传递参数.......
<% @language="vbscript" codepage="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/htm14/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>q_vbs</title>
<script language="vbScript">
<!--

option explicit
dim name
dim age
dim tips(4)
tips(0)="努力学习,坚持不懈"
tips(1)="尊师重教,以人为本"
tips(2)="十年树木,百年树人"
tips(3)="书读百遍,其义自现"
tips(4)="海纳百川,有容乃大"
const defaultname="佚名"
const defaultage="20"

sub givethemsg(name)
if age<15