是想实习,用JS点击链接跳出一张图片。但是不懂哪里出错了,实现不了
html代码如下<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="text.js"></script>
</head>
<body bgcolor="#ccffff">
  <h1>The Master of the House</h1>
  <h2>Click on His name to behold he Who Must Be Adored</h2>
  <h2><a href="#" class="newWin">Pixel</a><h2>
  
</body>
</html>js代码如下window.onload=newWinLinks;
function newWinLinks(){
for(var i=0;i<document.links.length;i++){
if(document.links[i].className=="newWins"){
document.links[i]=newWindow;
}
}
}function newWindow(){
var catWindow=window.open("zhuanbo1.jpg","catwin","width=200,height=200");
catWindow.focus();
return false;
}JavaScriptHTML

解决方案 »

  1.   

    直接<a href='img.jpg'/>Pixel</a>

    <a href='javascript:window.open("zhuanbo1.jpg","catwin","width=200,height=200");'/>Pixel</a>
      

  2.   

    其实很简单 ,如果你只是想在文字上 点击弹出一个新页能看这张图片的话 直接这样写就行
    <a href="aa.jpg" target="_blank">Pixel</a>
      

  3.   

    if(document.links[i].className=="newWins"){
    //document.links[i]=newWindow;
    document.links[i].click=newWindow;
    }
      

  4.   

    <h2><a href="#" class="newWin">Pixel</a><h2>
    --》if(document.links[i].className=="newWins"){