如何让 JavaScript 制作(生成)新页面? [英] How can I make JavaScript make (produce) new page?
本文介绍了如何让 JavaScript 制作(生成)新页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想做一个页面上的按钮,可以在同一个页面中调用一个JS函数.该函数将需要创建(打开)新窗口,其 HTML 代码是从 JS 函数本身给出的.我该怎么做?
I would like to make a button on a page that can call a JS function in the same page. The function will need to create (open) new window which its HTML code was given from the JS function itself. How can I do that?
这样做的目的是从特定页面中生成适合打印的页面.
The purpose of this is to produce a print friendly page out of a specific page.
请注意:不能使用 AJAX.
Please notice: No AJAX can be used.
推荐答案
var opened = window.open("");
opened.document.write("<html><head><title>MyTitle</title></head><body>test</body></html>");
这篇关于如何让 JavaScript 制作(生成)新页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文