<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script>
function drawRect(x1,y1,w,h){
document.getElementsByTagName("BODY")[0].innerHTML += '<div id=mov1 style="cursor:hand;border:solid 3px #ff0000;z-index:2;position:absolute;top:' 
+ (y1-h/2) + 'px;left:' + (x1-w/2) + 'px;width:' + w + 'px;height:' + h + 'px;" onclick="window.location='www.sina.com'">&nbsp;</div>';
}
</script>
</head><body onLoad="drawRect(400,260,100,100)"></body>
</html>

解决方案 »

  1.   

    function drawRect(x1,y1,w,h){
    document.getElementsByTagName("BODY")[0].innerHTML += '<div id=mov1 style="border:solid 3px #ff0000;z-index:2;position:absolute;top:' + (y1-h/2) + 'px;left:' + (x1-w/2) + 'px;width:' + w + 'px;height:' + h + 'px;">&nbsp;</div>';
    //===========================================================//
    document.getElementById("mov1").onclick = function(){doLink();};
    //===========================================================//}function doLink(){
      Response.redirect = "www.sina.com.cn";//可能是站内链接
    }