回 帖 发 新 帖 刷新版面

主题:怎么用按钮来控制文字的位置?

[size=3][color=FF00FF][color=C0C0C0][color=FF0000][color=0000FF][color=008080][color=0000FF][color=FF0000]我想问问怎么用按钮来控制文字的位置?
按钮是用循环来产生(如产生“靠左”,“置中”,“靠右”),而当点击相应的按钮时,文字的位置要有相应的变化,怎么能办到啊!
我写了一个程序,却怎么也不能实现,不知错在哪里?文件名是 10-4.asp[/color][/color][/color][/color][/color][/color][/color][/size]
<html>
<head><title>习题四</title>
</head>
<body>
<%
btnvalue=array("靠左","置中","靠右")
btnali=array("left","center","right")
%>
<h3 align="<%=alig%>">文字<%=btnvalue(i)%></h3>
<form method="post" action="10-4.asp">
<table border="1" align="center">
<tr>
<%
for i=0 to ubound(btnvalue)
response.Write "<td width=200 align=center><input type=submit name=btn"& i &" value="&btnvalue(i)&"></td>"
next
for i=0 to ubound(btnvalue)
if btnvalue(i)=request("btn" & i) then
alig=btnali(i)
end if
next
%>
</tr>
</table>
</form>
</body>
</html>

回复列表 (共1个回复)

沙发

<html>
<head><title>习题四</title>
</head>
<body>
<%
btnvalue=array("靠左","置中","靠右")
btnali=array("left","center","right")

for i=0 to ubound(btnvalue)
if btnvalue(i)=request("btn" & i) then
align=btnali(i)
end if
Next
%>
<h3 align="<%=align%>">文字</h3>
<form method="post" action="test.asp">
<table border="1" align="center">
<tr>
<%
for i=0 to ubound(btnvalue)
response.Write "<td width=200 align=center><input type=submit name=btn"& i &" value="&btnvalue(i)&"></td>"
next
%>
</tr>
</table>
</form>
</body>
</html>

我来回复

您尚未登录,请登录后再回复。点此登录或注册