开发者

javascript rendered HTML page still loading

I have a mother page, where is jvscrpt function called openWin() , which opens a new window. Here is my code:

<html>
<head>
<script type="text/javascript">
function openWin()
{
win=window.open();
win.document.write("<html>");
win.document.write("<head>");
win.document.write("<style type=\"text/css\">");
win.document.write("@media print{.input {display:none}}");
win.document.write("</style>");
win.document.write("</head>");
win.d开发者_开发技巧ocument.write("<body>");
win.document.write("<table align=\"center\">");
win.document.write("<tr><td>result:</td><td>100,--€</td></tr>");
win.document.write("<tr><td colspan=\"2\" id=\"idcko\"><input type=\"button\" value=\"click\" class=\"input\" onclick=\"window.print();\"/></td></tr>");
win.document.write("</table>");
win.document.write("</body>");
win.document.write("</html>");
}
</script>
</head>
<body>
<form>
<input type="button" value="Click me!" onclick="openWin();" />
</form>
</body>
</html>

When I click on button "Click me!" a new window appears, but browser can`t stop loading the page.The page has full functionality,but for example when I want to see source code in Mozilla, I get only a blank page. Please help...


call

win.document.close();

At the end(after the last write() )

It signals to the browser that the write-process is finished and the document is complete.


but for example when I want to see source code in Mozilla, I get only a blank page.

This is because the source was written by your javascript - this is the same as AJAX (you can't view the changes in the source).

Perhaps you would be better of just opening a new page and pass whatever paramters it needs either via a GET/POST or server-side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜