注册 登录
编程论坛 ASP技术论坛

关于VBSCRIPT的问题

janetding 发布于 2008-11-20 09:25, 818 次点击
asp初学者,在这段程序中,FOR...NEXT..语句看不太懂,高手帮忙讲解一下
谢谢啦
<%@ Language=VBScript %>
<html>
<title>
移动鼠标改变背景颜色
</title>
<SCRIPT ID=clientEventHandlersJS LANGUAGE=javascript>
<!--
function MakeColor(ThisColor) {
document.bgColor = ThisColor;
}
//-->
</SCRIPT>
<center>
<table cellspacing=2 Border="0">
<tr>
<%
Dim I1, I2, I3 ' Looping variables for RGB Color
For I1 = 0 to 15 step 3
For I2 = 0 to 15 step 3
For I3 = 0 to 15 step 3
Color = Hex(I1) & Hex(I1) & Hex(I2) & Hex(I2) & Hex(I3) & Hex(I3)
%>
<td bgcolor="#<%=Color%>">
<a href="#" LANGUAGE=javascript OnMouseOver="return MakeColor('#<%=Color%>');">
<img src="clear.gif" width=10 height=10 border="0"></a>
</td>
<%
Next
Next
%>
</tr>
<tr>
<%
Next
%>

</tr>
</table>
</center>
</html>

[[it] 本帖最后由 janetding 于 2008-11-20 09:26 编辑 [/it]]
2 回复
#2
sldtk12008-11-20 09:39
Dim I1, I2, I3        '定义颜色变量
For I1 = 0 to 15 step 3     ’从0到15循环,步长为3,即取值为0 3 6 9 12 15
For I2 = 0 to 15 step 3     
For I3 = 0 to 15 step 3
Color = Hex(I1) & Hex(I1) & Hex(I2) & Hex(I2) & Hex(I3) & Hex(I3)'转换为16进制
%>
#3
janetding2008-11-20 10:27
谢谢版主
1