javascript实现:
第一题:
<html><head><script language="javascript">
function goPage(){
var sInput=document.all.Amount.value
if(sInput.length==0){alert("请输入购物款数额!")return}
var nAmount=parseInt(sInput)
if(nAmount<500){
location.href="1.asp"
}else if(nAmount<1000){
location.href="2.asp"
}else if(nAmount<2000){
location.href="3.asp"
}else{location.href="4.asp"
}
}
</script></head>
<body>
购物款数额:<input type="text" id="Amount">
<input type="button" value="Go!" onclick="goPage()">
</body></html>
第二题:
<html><head><script language="javascript">
function goPage(){
var sInput=document.all.N.value
if(sInput.length==0){alert("请输入计算参数N!")return}
var N=parseInt(sInput)
var i,sum=0
for(i=1i<=Ni++) sum+=i
document.all.Result.value=sum
}
</script></head>
<body>
累加到N:<input type="text" id="N">
<input type="button" value="Go!" onclick="goPage()"><br>
计算结果:<input type="text" id="Result" readonly>
</body></html>
ASP实现:
第一题:
<html><head><script language="javascript">
function validInput(){
var sInput=document.all.Amount.value
if(sInput.length==0){alert("请输入购物款数额!")return false}
return true
}
</script></head>
<body>
<%
Dim Amount
Amount=Trim(Request("Amount"))
If Len(Amount)>0 Then
Amount=CInt(Amount)
If Amount<500 Then
Response.Redirect "1.asp"
ElseIf Amount<1000 Then
Response.Redirect "2.asp"
ElseIf Amount<2000 Then
Response.Redirect "3.asp"
Else
Response.Redirect "4.asp"
End If
End If
%>
购物款数额:<form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" onsubmit="validInput()">
<input type="text" id="Amount" name="Amount"><input type="submit" value="Go!">
</form>
</body></html>
第二题:
<html><head><script language="javascript">
function validInput(){
var sInput=document.all.N.value
if(sInput.length==0){alert("请输入计算参数N!")return false}
return true
}
</script></head>
<body>
累加到N:<form action="<%=Request.ServerVariables("SCRIPT_NAME")%>" onsubmit="validInput()"><input type="text" name="N" id="N">
<input type="submit" value="Go!"></form><br>
计算结果:
<%
Dim N,Sum,i
N=Trim(Request("N"))
If Len(N)>0 Then
N=CInt(N)
Sum=0
For i=1 To N
Sum=Sum+i
Next
Response.Write Sum
Else
Response.Write "尚未输入参数!"
End If
%>
</body></html>
是真的,完全可以去使用的www.kfcyouhui.com打印正版肯德基电子优惠券,麦当劳电子优惠券:http://www.mcdonalds.com.cn/coupon/cp.asp如果输出HTML代码多,建议使用 blacklong 的回答。如果你真要用response.write。这样就可以
response.write "<a href=""javascript:openwin('printers.asp?id="&rs("id")&"','width=600,height=500')"" class=""link1"">打印商家优惠券</a>"
注:asp中要输出 双引号,用【 "" 】两个双引号。
欢迎分享,转载请注明来源:夏雨云
评论列表(0条)