ASP中怎么实现这个简单的功能(迷茫了)

liu_guanfeng 2009-08-05 07:36:03
<form action="hello3.asp">

<input type="text" name="tx" value="<%=name1%>">
<% fname=request.Form("tx")
if fname="" then
name1="Hi"
else if fname="Hello" then
name1="Hi"
else if fname="Hi" then
name1="Hellow"

end if
end if

end if%>
<input type="submit" name="Submit" value="submit">
</form>
就是类似如上的代码,开始显示Hi,点击按钮后显示Hello,再点击又显示Hi 重复不断。
这个怎么实现啊?上门的代码不能实现。
...全文
198 18 打赏 收藏 转发到动态 举报
写回复
用AI写文章
18 条回复
切换为时间正序
请发表友善的回复…
发表回复
norman3036383 2009-08-06
  • 打赏
  • 举报
回复
if fname="" or fname="Hello" then
name1="Hi"
else
name1="Hello"
end if
pumnfood 2009-08-06
  • 打赏
  • 举报
回复
不就是16楼那样吗,还想怎么样?
number123456 2009-08-05
  • 打赏
  • 举报
回复
我有点搞不董LZ是什么意思了,你现在不是己经实现了吗?不用JSCRIPT那你的ASP己经是这种结果了,
heatonc 2009-08-05
  • 打赏
  • 举报
回复
hello3.asp?tx=Hello%21
她是把变量放到了显示内容中!!!
xzx99 2009-08-05
  • 打赏
  • 举报
回复
UP
in0512 2009-08-05
  • 打赏
  • 举报
回复

<%
dim test11
test11=request("test1")
if test11="hi" then
test11="hello"
else
test11="hi"
end if
%>
<form action=? method=post>
<input type=text name=test1 value=<%=test11%>>
<input type=submit value="enter">
</form>
toury 2009-08-05
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 liu_guanfeng 的回复:]
用post能行吗?
[/Quote]
当然可以。红字要对应起来。如果form的method用GET,那就用fname=request.querystring("tx")
<%
fname=request.Form("tx")
if fname="" or fname="Hello" then
name1="Hi"
else
name1="Hellow"
end if
%>
<form method=post action="hello3.asp" name=frm>
<input type="text" name="tx" value=" <%=name1%>">
<input type="submit" name="Submit" value="submit">
</form>
不过,简单问题为什么复杂化呢?除非你是学习中。呵呵
liu_guanfeng 2009-08-05
  • 打赏
  • 举报
回复
用post能行吗?
toury 2009-08-05
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 liu_guanfeng 的回复:]
非常感谢,这个是在button上显示的啊,我想在text中显示怎么弄呢?就是下面网站的结果

http://spider.ics.mq.edu.au/ics/yanwang/hello3.asp
[/Quote]

<input type="text" style="width:60px;" name="tx" value="Hi" onclick="this.value=this.value=='Hi'?'Hello':'Hi'"} />

liu_guanfeng 2009-08-05
  • 打赏
  • 举报
回复
谢谢楼上,javascript 可以实现。如果不用JSCRIPT 能实现吗?
number123456 2009-08-05
  • 打赏
  • 举报
回复
<input type="text" name="tx" value="hi" id="tx">
<input type="submit" name="Submit" value="submit" onclick="if(document.getElementById('tx').value=='hi'){document.getElementById('tx').value='hellow';}else{document.getElementById('tx').value='hi';}">
chengx1216 2009-08-05
  • 打赏
  • 举报
回复
我没有学过
liu_guanfeng 2009-08-05
  • 打赏
  • 举报
回复
非常感谢,这个是在button上显示的啊,我想在text中显示怎么弄呢?就是下面网站的结果

http://spider.ics.mq.edu.au/ics/yanwang/hello3.asp
wosytl 2009-08-05
  • 打赏
  • 举报
回复
ddddddddddddddd
toury 2009-08-05
  • 打赏
  • 举报
回复

<input type="button" style="width:60px;" name="tx" value="Hi" onclick="this.value=this.value=='Hi'?'Hello':'Hi'"} />
lzp4881 2009-08-05
  • 打赏
  • 举报
回复
<input type="button" style="width:60px;" name="tx" value="Hi" onclick="if (this.value=='Hi'){this.value='Hello'}else{this.value='Hi'}"/>
ilxl520 2009-08-05
  • 打赏
  • 举报
回复

<%
fname=request.Form("tx")
if fname="" or fname="Hello" then
name1="Hi"
else
name1="Hello"
end if
%>

<form action="hello3.asp">
<input type="text" name="tx" value=" <%=name1%>">
<input type="submit" name="Submit" value="submit">
</form>
东南西北中瓜 2009-08-05
  • 打赏
  • 举报
回复

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧