我可以打开一个新的窗口并用一个字符串变量填充吗? [英] Can I open a new window and populate it with a string variable?
本文介绍了我可以打开一个新的窗口并用一个字符串变量填充吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
解决方案
是的,可以...
code> var wnd = window.open(about:blank,,_blank);
wnd.document.write(html);
这应该是诀窍。
I am having a bit of a battle with something that seems simple. I have a [javascript] string that has DOM elements in it and would like to open a new window (window.open()?) and use the string the populate the new window. i.e. have the browser take the string and convert it into HTML on the fly. Is this possible?
解决方案
Yes it's possible...
var wnd = window.open("about:blank", "", "_blank");
wnd.document.write(html);
That should do the trick.
这篇关于我可以打开一个新的窗口并用一个字符串变量填充吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文