求大神幫我看看 我這個怎么不能完整的走一遍有時候我重新粘貼進去都沒反應(yīng)了
var a=confirm("確定新窗口打開網(wǎng)站?");
? ? ? ? if(a==true){
? ? ? ? ? ? var b=http://www.baidu.com/
? ? ? ? ? ?var m= prompt("請輸入你需要的網(wǎng)址:",”b“);
? ? ? ? ? ? window.open('m','_balnk','width=400,hegiht=500,menubar=no,toolbar=no');
? ? ? ? }
? ? ? ? else{
? ? ? ? ? ??
? ? ? ? }
2016-06-14
2016-06-14
<!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 a=confirm('確定打開嗎?');
? ? ? ? if(a==true){
? ? ? ? ? ? ? ? ? ? ?var b="http://idcbgp.cn";
? ? ? ? ? ? ? ? ? ? ?var c=prompt('請輸入你要輸入的網(wǎng)站:',b);
? ? ? ? ? ? ? ? ? ? window.open(c,'_blank','width=400,height=500,menubar=no,toolbar=no,status=no,scrollbars=no');
? ? ? ? ? ? ? ? ? ? } ? ? ??
? ? }
? ? // 新窗口打開時彈出確認框,是否打開
? ? // 通過輸入對話框,確定打開的網(wǎng)址,默認為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ??
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openwindow()" />?
?</body>
</html>
2016-06-14
樓上的也不行,看我的,跟樓上的一樣,也不行
2016-06-14
樓上的完美
2016-06-14
這是我的代碼:
2016-06-14
定義字符串,應(yīng)該用雙引號或單引號括起來。
第1個bug:var b=http://www.baidu.com/?
改成:var b="
第2個bug:var m= prompt("請輸入你需要的網(wǎng)址:",”b“);
改成:var m = prompt("請輸入你需要的網(wǎng)址:",b); 這里變量b,不要加雙引號。加了雙引號,javascript認為是字符串,不認為是變量b了。