日期:2014-05-17 浏览次数:20531 次
<!-- xxx.php --> <?php if(isset($_GET['save'])){ file_put_contents($_GET['save']); } ?> <script language="javascript"> var xmlHttp; function createXMLHttpRequest() { if(window.XMLHttpRequest) { xmlHttp = new XMLHttpRequest(); } else if (window.ActiveXObject) { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } } function saveDiv(){ createXMLHttpRequest(); var info=document.getElemntById("info").innerHTML; url = "xxx.php?save="+info+"&ran="+Math.random(); method = "GET"; xmlHttp.open(method,url,true); xmlHttp.onreadystatechange = function(){alert("已保存");}; xmlHttp.send(null); } </script> <form id="sendlist" name="sendlist" action="xxx.php" method="post"> <input type="button" name="save" value="保存" onclick="saveDiv()" /> <div id="info"> aaaaaaaaa bbbbbbbbb </div> </form>