<%@Language = "Javascript" %>
<%
//Response.Write(Request.ServerVariables("http_accept"));
var a=Request.QueryString('a').Item;
var b=Request.QueryString('b').Item;
if(!a){total="";}
else{
var total=a-0+(b-0);}
acc=Request.ServerVariables('HTTP_ACCEPT')+''
if (acc.indexOf('asfman')!=-1) {
Response.Write(total)
} else {
%>
<script>
var xmlhttp = new XMLHttpRequest();
function calc() {
frm=document.forms[0]
url="?a="+frm.elements['a'].value+"&b="+frm.elements['b'].value
xmlhttp.open("GET",url,true);
xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.forms[0].elements['total'].value=xmlhttp.responseText
}
}
xmlhttp.setRequestHeader('Accept','asfman');
xmlhttp.send()
return false
}
</script>
<form action="" method="get" onsubmit="return calc()">
<input type=text name=a value="<%=a%>"> + <input type=text name=b value="<%=b%>">
= <input type=text name=total value="<%=total%>">
<input type=submit value="Calculate">
</form>
<%
}
%>
posted on 2007-10-24 15:41
汪杰 阅读(1569)
评论(0) 编辑 收藏 引用 所属分类:
asp(javascrpt) 、
javascript