21,886
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>test page</title>
<script type="text/javascript" src="http://localhost/leb/auto/js/jquery-latest.js"></script>
<script type="text/javascript">
$(function(){
var html= $(".page")[0].innerHTML;
$.ajax({
cache : false,
type : "POST",
url : "file.php",
data : "html="+html,
dateType : "text"
});
});
</script>
</head>
<body>
<div class="page">
<span>more>></span>
<div>other infos</div>
</div>
</body>
</html>
<?php
$html=$_POST['html'];
$file=fopen('result.html','w');
fwrite($file,$html);
fclose(file);
?>
data : "html="+encodeURIComponent(html),
$(function(){
$.ajax({
cache : false,
type : "POST",
url : "file.php",
data : {html:$(".page:eq(0)").html()},//如果只有一个.page可以去掉:eq(0)
dateType : "text"
});
});
这样试试呢?