vb中如何实现每次刷新出现的内容不一样

来源:百度知道 编辑:UC知道 时间:2024/06/05 10:49:06
各位大哥大姐,我遇到了一个问题想了好多天也没想出来什么地方不对,望哪位高手能帮我解决
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>动态文字页面</title>
</head>

<body>
<h2><i><font color="#33CCFF"><center>
每次的内容都不一样!</center></font></i></h2>
<div align="center">
<script language="vbscript">
Const TipNo = 6
Dim tips(6)
tips(0) = "★中国铁道出版社"
tips(1) = "★计算机图书项目中心"
tips(2) = "★真诚的面对每一位读者"
tips(3) = " ★欢迎光临seconworld★"
tips(4) = "★请多多指教"
tips(5) = "★我的最爱"
Randomize
index = Int((TipNo) * Rnd)
document.write("<center><p><b><font size=6>" & tips(index) & "</center>
</font></b> </p>")
</script>

下面这行代码在</center>后面不要有回车,因为VBScript认为回车是一条语句结束的标志
document.write("<center><p><b><font size=6>" & tips(index) & "</center>
</font></b> </p>")

所以修改方法有两种:
一、将</center>后面的回车去掉,将一句话写在一行上
二、用换行符,修改后的代码如下:
document.write("<center><p><b><font size=6>" & tips(index) & "</center>" & _
"</font></b> </p>")