簡體   English   中英

警報框:單擊“確定”,然后彈出一個新的瀏覽器窗口到另一個網站,如何?

[英]Alert Box: click ok then pop up a new broswer window to another website, How?

javascript,例如:

<script type="text/javascript">
if(!alert("msg here ")) document.location = 'http://google.com';
</script>

此腳本僅在相同的選項卡或窗口中轉到google,我要彈出一個窗口,然后轉到google.com。 謝謝。

不友好的方式:

<script type="text/javascript">
if(!alert("msg here")) window.open("http://google.com");
</script>

更友好的方式:

<script type="text/javascript">
if(confirm("Do you wish to go to google?")) window.open("http://google.com");
</script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM