點擊按鈕(button)打開新窗口(window)的幾種情況

點擊按鈕(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()打開的窗口的所有屬性。
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章