<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&g开发者_Go百科t;
</body>
</html>
after i clicked the "Click me button" 5-6 times.. NEW HTML that is generated . isnt it ?
So I want to save that new generated HTML in a file through ASP.Net or PHP
Any idea's How to do it ?
Copy the body contents into a textarea and submit it in a form.
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);
}
UPDATE Added css storing code.
精彩评论