代碼錯(cuò)在哪里,為什么新建的網(wǎng)頁(yè)是這樣的
為什么新建的網(wǎng)頁(yè)網(wǎng)址是這樣的http://idcbgp.cn/code/http://idcbgp.cn
以下是代碼
<!DOCTYPE html>
<html>
?<head>
? <title> new document </title> ?
? <meta http-equiv="Content-Type" content="text/html; charset=gbk"/> ??
? <script type="text/javascript"> ?
? ??
? ? // 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? // 通過(guò)輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? //打開的窗口要求,寬400像素,高500像素,無(wú)菜單欄、無(wú)工具欄。
? ? ?function openWindow(){
? ? var askopen=confirm("是否打開網(wǎng)頁(yè)") ;
? ? if(askopen==true)
? ? {
? ? var my = 'http://idcbgp.cn/';
? ? ? ? url = prompt('請(qǐng)輸入網(wǎng)址', my);
? ? ? ? window.open(my,'_blank','width=600,height=400,top=100,left=0')?
;
? ? }
? ? else
? ? {
? ? }
? }?
? ??
? </script>?
?</head>?
?<body>?
?<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />?
?</body>
</html>
2017-07-27
你的Http后面的引號(hào)是中文的引號(hào),改成西文的引號(hào)打開正常
2017-08-04
http后面的:是中文的,我也一樣,直接復(fù)制右邊任務(wù)的網(wǎng)址,被坑了
2017-07-28
你的代碼除了上面冒號(hào)的問(wèn)題還有編程的問(wèn)題。你的想法應(yīng)該是除了默認(rèn)的imooc網(wǎng)址能打開外,你不用默認(rèn)的imooc例如你在消息對(duì)話框出來(lái)時(shí)把默認(rèn)的imooc網(wǎng)址換為baidu,你就會(huì)發(fā)現(xiàn)出來(lái)的還是imooc網(wǎng)頁(yè)。我改的:
function openWindow(){
? ? var askopen=confirm("if open the web?") ;
? ? if(askopen==true)
? ? {
? ? var myweb=prompt("please input website:","http://idcbgp.cn/");
? ? ? ?
? ? ? ? window.open(myweb,'_blank','width=600,height=400,top=100,left=0');?
? ? }
? ? else
? ? {
? ? }
? }?
請(qǐng)忽略某些蹩腳的英語(yǔ),我的電腦顯示中文會(huì)亂碼,所以隨便改的英文
2017-07-27
這個(gè)有什么問(wèn)題嗎?
2017-07-27
說(shuō)錯(cuò)了,是冒號(hào)