JS点击按钮打开新的独立页面

https://blog.csdn.net/qq_36409820/article/details/76180643

点击按钮(button)打开新窗口(window)
从事前端制作的朋友都有碰到过,需要点击按钮跳转到另外一个页面。只要用到简单的onclick事件就可以简单实现效果。
方式一:在原来的窗口上打开新窗口

 <input type="button" value="点击我看看效果" onclick="window.location='http://linlizhu.cn'" />

方式二:在新打开的窗口上打开新窗口

<input type="button" value="点击我看看效果" onclick="window.open('http://linlizhu.cn')" />

方式三:在新打开的一块小窗口上打开新窗口,此窗口没有菜单栏window.showModalDialog(‘http://linlizhu.cn’)

<input type="button" value="点击我看看效果"
     onclick="window.showModalDialog('http://linlizhu.cn')" />

window.showModalDialog()方法用来创建一个显示HTML内容的模态对话框,由于是对话框,因此它并没有
一般用window.open()打开的窗口的所有属性。

猜你喜欢

转载自blog.csdn.net/qq_26249609/article/details/84030665
今日推荐