日期:2014-05-17 浏览次数:20955 次
//Ajax Start function Ajax_GetXMLHttpRequest() { if (window.ActiveXObject) { return new ActiveXObject("Microsoft.XMLHTTP"); } else if (window.XMLHttpRequest) { return new XMLHttpRequest(); } } function Ajax_CallBack(FormName,ID,URL){ var x = Ajax_GetXMLHttpRequest(); var ID = document.getElementById(ID); x.open("POST",URL); x.setRequestHeader("REFERER", location.href); x.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); x.onreadystatechange = function(){if(x.readyState == 4 && x.status == 200 && ID){ID.innerHTML=x.responseText;}} var encodedData="" if (document.forms.length > 0 && FormName) { var form = document.forms[FormName]; for (var i = 0; i < form.length; ++i) { var element = form.elements[i]; if (element.name) { var elementValue = null; if (element.nodeName == "INPUT") { var inputType = element.getAttribute("TYPE").toUpperCase(); if (inputType == "TEXT" || inputType == "PASSWORD" || inputType == "HIDDEN") { elementValue = escape(element.value); } else if (inputType == "CHECKBOX" || inputType == "RADIO") { if (element.checked) { elementValue = escape(element.value); } } } else if (element.nodeName == "SELECT" || element.nodeName == "TEXTAREA") { elementValue = escape(element.value); } if (elementValue) { if(encodedData==""){ encodedData = element.name + "=" + encodeURIComponent(elementValue); } else{ encodedData += "&" + element.name + "=" + encodeURIComponent(elementValue); } } } } } x.send(encodedData); } //Ajax End function SaveOOOO(字段名) { Ajax_CallBack(false,"SaveOOOO","save.asp?字段名=" + escape(字段值));}
------解决方案--------------------
参考:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>在线考试系统—JS模拟翻页</title> <script type="text/javascript"> function doit(obj) { var ps=3; //总页数 var p=form1.page.value; if(obj=="back" && p>1){p--;} if(obj=="next" && p<ps){p++;} form1.page.value=p; var d=form1.document.getElementsByTagName("div"); for(var i=0;i<d.length;i++) { d[i].style.display="none"; if(i+1==p){d[i].style.display="block";} } } </script> </head> <body> <form name="form1" method="post" action=""> <div> 第一题:你打死了它,流的却是你的血?(打一昆虫)<br /> 答:<input type="text" name="A1" /> <p>第一页的其他题目...</p> </div> <div style="display:none;"> 第二题:你打死了它,流的却是你的血?(打一昆虫)<br /