寫的貌似對 ,但是運行不了
???fonction?openWindow(){
???????var?open=confirm("是否打開網頁");
???????if(open==true){
???????????var?input=pormpt("請確認打開的網址","http://www.xianlaiwan.cn/");
???????????window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
???????}
2015-08-10
括號是成對出現的,函數最后還差個}.
定義函數名的關鍵字寫錯了,是function不是fonction。
var?input=pormpt("請確認打開的網址","http://www.xianlaiwan.cn/");這一行2處錯誤,是prompt不是pormpt。括號里面的引號中間的逗號是英文逗號,不是中文逗號,改過來噻。
window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');這一行括號里面的冒號也寫成了中文冒號,改成英文的吧。
修改后的代碼,你看下
<!DOCTYPE?html> <html> <head> ????<title>?new?document?</title> ????<meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"/> ????<script?type="text/javascript"> ????????function?openWindow(){ ????????????var?open=confirm("是否打開網頁"); ????????????if(open==true){ ????????????????var?input=prompt("請確認打開的網址","http://www.xianlaiwan.cn/"); ????????????????window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no'); ????????????} ????????} ????</script> </head> <body> <form> ????<input?type="button"?value="新窗口打開網站"?onclick="openWindow()"?/> </form> </body> </html>2015-08-09
是不是使用了input關鍵詞,換掉試一下。
2015-08-08
改了也不能運行
2015-08-07
是function ?你這個單詞不對,改改在試試
2015-08-07
function是這么寫嗎?還貌似對?