在插入 HTML 的 JavaScript 中打开窗口 [英] Open window in JavaScript with HTML inserted

查看:25
本文介绍了在插入 HTML 的 JavaScript 中打开窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 JavaScript 中打开一个新窗口并插入 HTML 数据,而不仅仅是链接到 HTML 文件?

How would I open a new window in JavaScript and insert HTML data instead of just linking to an HTML file?

推荐答案

你可以使用 window.open 在 javascript 中打开一个新窗口/标签(根据浏览器设置).

You can use window.open to open a new window/tab(according to browser setting) in javascript.

通过使用 document.write,您可以将 HTML 内容写入打开的窗口.

By using document.write you can write HTML content to the opened window.

这篇关于在插入 HTML 的 JavaScript 中打开窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆