修改url ,如果要修改訪問網(wǎng)址,要怎么改 ?求解 ~~~
<!DOCTYPE html>
<html>
<head>
? ?<title> new document </title>
? ?<meta http-equiv="Content-Type" content="text/html; charset=gbk"/>
? ?<script type="text/javascript">
? ? ? ?function openWindow(){
? ? ? ? ? ?// 新窗口打開時(shí)彈出確認(rèn)框,是否打開
? ? ? ? ? ?var openwindow=confirm("是否打開?");
? ? ? ? ? ?if(openwindow==true){
? ? ? ? ? ? ? ?// 通過輸入對(duì)話框,確定打開的網(wǎng)址,默認(rèn)為 http://idcbgp.cn/
? ? ? ? ? ? ? ?var url="http://idcbgp.cn/";
? ? ? ? ? ? ? ?var mes=prompt("請輸入或核對(duì)網(wǎng)址:",url);
? ? ? ? ? ? ? ?if(mes!=null){
? ? ? ? ? ? ? ? ? ?//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
? ? ? ? ? ? ? ? ? ?window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
? ? ? ? ? ? ? ?}else{
? ? ? ? ? ? ? ? ? ?alert("請輸入一個(gè)url");
? ? ? ? ? ? ? ?}
? ? ? ? ? ?}else{
? ? ? ? ? ? ? ?alert("你選擇不打開網(wǎng)址。");
? ? ? ? ? ?}
? ? ? ?}
? ?</script>
</head>
<body>
<input type="button" value="新窗口打開網(wǎng)站" onclick="openWindow()" />
</body>
</html>
2016-01-14
你把url賦值了imooc,彈出框你輸入新地址賦值的是mes,但是你open時(shí)用的還是以前的url!? 只要把url改為mes就可以打開新地址了!希望采納。