javascript问题

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>location</title>
</head>
 <script type="text/javascript">
     document.write( location.href+"<br/>");
     var ahref=location.href;
     function test(){
     window.open("ahref" ,"_blank","width=400px,height=400px")
     }
 </script>
</head>
<body>
<input type="button" value="点击弹出"  onclick="test()">
</body>
</html>

为什么新打开的窗口不是location.href?

hawthornn
浏览 1152回答 1
1回答

李晓健

window.open(ahref ,"_blank","width=400px,height=400px") // ahref 是变量不是字符串,不能加引号
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript