在點擊window.showModalDialog窗口的連接的時候阻止打開新窗口

在點擊window.showModalDialog窗口的連接的時候會打開新窗口,想要阻止打開新窗口,須要在窗口頁面中的html和body之間

加入: <base target="_self" />便可。 javascript

注:但這個設置只對普通連接有效,對window.location.href 打開的連接無效。 html

對於表單提交打開新窗口,在子窗口中加入: java

<script type="text/javascript"> spa

window.name="spare" ; orm

</script> htm

<form target="spare"> ip

注:form 表單設置成 target="_self"是無效的。 get

相關文章
相關標籤/搜索