求小图看大图JS,弹出大图必须在区域内(有图有代码) 详细内容:http://bbs.blueidea.com/thread-2991366-1-1.html

解决方案 »

  1.   

    我这儿有一段代码,你看看能用不
    <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
    <!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=gb2312" />
    <title>无标题文档</title>
    </head>
    <body>
    <style>
    #demo{overflow:hidden;width:120px;text-align:center;padding:10px;}
    #demo img{border:none;width:100px;height:100px;border:5px solid #f4f4f4}
    #openlayer{position:absolute;display:none;z-index:2;border:50px solid #f4f4f4}
    </style>
    <div id="demo" style="overflow:hidden;width:120px;text-align:center;padding:10px"> <img src="bianyaqizhujiexian1.PNG" width="135" height="531" _fcksavedurl="http://www.bnxb.com/uploads/allimg/c091113/125P9441PW0-13335.jpg" /></div>
    <div id="openlayer"></div>
    <script>
    var demo = document.getElementById("demo");
    var gg = demo.getElementsByTagName("img");
    var ei = document.getElementById("openlayer");
    for(i=0; i<gg.length; i++){
     var ts = gg[i];
     ts.onmousemove = function(event){
      event = event || window.event;
      ei.style.display = "block";
      ei.innerHTML = '<img src="' + this.src + '" />';
      ei.style.top  = document.body.scrollTop + event.clientY + 10 + "px";
      ei.style.left = document.body.scrollLeft + event.clientX + 10 + "px";
     }
     ts.onmouseout = function(){
      ei.innerHTML = "";
      ei.style.display = "none";
     }
     ts.onclick = function(){
      window.open( this.src );
     }
    }
    </script>
    </body>
    </html>
      

  2.   

    能找到地址,就查看源代码或是用firebug去取