<html>
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("button").click(function(){
$("p").after(" Hi .");
});
});
</script>
</head>
<body>
<h2>This is a heading</h2>
<p>This is a paragraph.</p>
<p>This is another paragraph.</p>
<button>Click me</button>
</body>
</html>在我点击了5-6次“点击我的按钮”之后..生成的新HTML。不是吗?
所以我想通过ASP.Net或PHP将新生成超文本标记语言保存在一个文件中
你知道该怎么做吗?
发布于 2011-01-13 01:43:09
将正文内容复制到文本区域中,并在表单中提交。
var css = $("style:first").html(); //this will ver the first style tag
$("#myCssTextarea")
.val("<style type='text/css'>"+css+"</style>");
var html = $("body").html();
$("#myTextarea")
.val(html)
.parents("form")
.submit();HTML
<form action="" method="post">
<textarea id="myTextarea" name="content" style="width:0; height:0;"></textarea>
<textarea id="myCssTextarea" name="cssContent" style="width:0; height:0;"></textarea>
</form>PHP
if($_POST["content"]){
$file = fopen('mypage.html', 'w');
fwrite($file, $_POST["content"]);
fwrite($file, $_POST["cssContent"]);
fclose($file);
}更新增加了css存储代码。
https://stackoverflow.com/questions/4671846
复制相似问题