test.htm

来自「JavaScript_VBScript网页编程实例」· HTM 代码 · 共 70 行

HTM
70
字号
<html>
<head>
<title>VBScript基础例程</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>

<body bgcolor="#FFFFFF">
<p align="center"> 
<img src="MusicCD.gif" width="32" height="32">
<font size="6"> <b>唱 片 街</b> </font></p>
<p>

<script language="VBScript">
 if hour(Now) < 12 then
   document.write("<b><i>上午好!欢迎光临唱片街!</i></b>")
 elseif hour(Now) < 18 then
   document.write("<b><i>下午好!欢迎光临唱片街!</i></b>")
 else
   document.write("<b><i>晚上好!欢迎光临唱片街!</i></b>")
 end if
 window.status="听音乐,到唱片街!"
</script>

</p>
<form name="form1" >
  <p>您在本店共购买磁带
    <input type="text" name="number1" size=4>
    盒,光盘
    <input type="text" name="number2" size=4>
    张</p>
  <p>
  <input type="button" name="CalSum" value="按此计算您的费用">
  </p>
</form>

<script language="VBScript">
<!--Option explicit
'显示定义每一个变量
sub CalSum_onClick()
  dim n1
  dim n2
  dim sum
  dim msg1
  dim msg2
  dim msg
  dim title

  if document.form1.number1.value="" then
     n1=0
  else
     n1=cint(form1.number1.value)
  end if
  if document.form1.number2.value="" then
     n2=0
  else  
     n2=cint(form1.number2.value)
  end if
  sum=8*n1+15*n2
  title="唱片街消费预算"
  msg1="磁带8元一盒,光盘15元一张,"
  msg2="您总共需要花费"+cstr(sum)+"元."
  msg=msg1+chr(13)+chr(10)+msg2
  x=msgbox(msg,0,title)
end sub
-->
</script>

</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?