結合if判斷
<!DOCTYPE?html> <html> <head> <meta?charset="UTF-8"> <title>Document</title> <script> function?buttonUrl(){ if(confirm('是否打開慕課網?')){ if(prompt('下面網址是慕課網官網嗎?','http://www.xianlaiwan.cn')){ open('http://www.xianlaiwan.cn','_blank','width=400,height=600,menbar=no,toolbar=no'); } } } </script> </head> <body> <button?onclick="buttonUrl()">彈彈彈</button> </body> </html>
2015-12-15
和c語言類似啊,if()內為真則執行