use*_*987 3 html javascript dreamweaver
我在网页上有想要链接到其他网站的图片,但是在一个特定大小的新窗口中.在Dreamweaver中,我使用了Window> Behaviors> onMouseClick,但由于某种原因,这是行不通的.图像无法识别为链接.
有没有其他方法可以让它在一个设定大小的新窗口中打开一个链接,这次实际上它有用吗?
这是Dreamweaver生成的代码:
<script language="JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
Run Code Online (Sandbox Code Playgroud)
链接:
<img src="images/portfolio/featured1.jpg" alt="Google" width="241" height="200" border="0" onclick="MM_openBrWindow('http://www.google.com','google','scrollbars=yes,width=650,height=500')" />
Run Code Online (Sandbox Code Playgroud)
嗯,这在Opera中适合我.它也是有效的HTML.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Test popup</title>
</head>
<body>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<p>the link:
<img src="notice.png"
alt="Google"
width="241" height="200"
style="border: 0;"
onclick="MM_openBrWindow('http://www.google.com','google','scrollbars=yes,width=650,height=500')">
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这更好:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>Test popup</title>
</head>
<body>
<script type="text/javascript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<p>the link:
<a href="http://www.google.com" onclick="MM_openBrWindow('http://www.google.com','google','scrollbars=yes,width=650,height=500'); return false;">
<img src="notice.png"
alt="Google"
width="241" height="200"
style="border: 0;"></a>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
它更好,因为(a)有一个链接,所以你会看到鼠标的"手"图标; (b)链接实际上在某个地方,因此关闭javascript的人仍然可以访问内容.("onclick"属性中的"return false"表示打开javascript的人只获取弹出链接."false"会在正常链接后停止浏览器.)
| 归档时间: |
|
| 查看次数: |
21026 次 |
| 最近记录: |