请问用vbscript编写一个asp的网页怎么样写?

来源:百度知道 编辑:UC知道 时间:2024/05/19 13:02:39
编写的内容是对用户输入的名字问好,并且判断时间,并且分时段问好。

新建个1.asp文件 把下面的代码复制进去

<form name="form1" method="post" action="1.asp">
请输入姓名:
<input name="name" type="text" id="name">
<input type="submit" name="Submit" value="提交">
</form>

<%if request.Form("name")<>"" then%>
<%
h=hour(now())
if h>=6 and h<12 then
a="上午好"
elseif h>=12 and h<14 then
a="中午好"
elseif h>=14 and h<18 then
a="下午好"
elseif h>=18 and h<24 then
a="晚上好"
else
a="凌晨好"
end if
%>
<div align="center"><strong><%=request.Form("name")&a%></strong></div>
<%end if%>