日期:2014-05-17  浏览次数:20903 次

图片显示问题
<table   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
<tr>
<td>
<img   src= "小图片的url "   onmouseover= "showtips(this, '大图片的URL '); "> <br/> <br/> <br/> </td>
<td>   </td>
</tr>

</table>

<script   language= "javascript "   type= "text/javascript ">
function   showtips(obj,tipStr){
//dhTipsLayer:author:dh20156;
var   e=e   ||   window.event;
var   pos   =   getObjPosition(obj);
if(   document.getElementById( "dhtipscontent ")==null){
var   div   =   document.createElement( "DIV ");
div.id   =   "dhtipscontent ";
div.style.padding   =   "10px ";
div.style.width   =   "200px ";
div.style.background   =   "white ";
div.style.border   =   "5px   solid   buttonface ";
div.style.position   =   "absolute ";
div.oncontextmenu   =   function(){return   false}

document.body.appendChild(div);
}
document.getElementById( "dhtipscontent ").style.display   =   "block ";
document.getElementById( "dhtipscontent ").innerHTML   =   tipStr;
document.getElementById   ( "dhtipscontent ").style.left   =   pos[0]+obj.offsetWidth;
document.getElementById( "dhtipscontent ").style.top   =   pos[1];
}
function   hidetips(){
try{
document.getElementById( "dhtipscontent ").innerHTML   =   " ";
document.getElementById( "dhtipscontent ").style.display   =   "none ";
}catch(e){}
}
function   getObjPosition(obj){
var   point=new   Array(0,0);
while(obj!=document.body){
point[0]+=obj.offsetLeft   ;
point[1]+=obj.offsetTop;
obj=obj.offsetParent;
}
return   point;
}
if(document.all){
document.attachEvent( "onclick ",hidetips);
}else{
document.addEventListener( "click ",hidetips,true);
}
</script>

我用上面的代码,写入了大小图片的地址,比如小图片地址为1.jpg,大图为2.jpg,但遇到的是,小图能显示,但大图不能,只能显示大图的名字,请问该怎么办?
还有就是,我想让大图展示多一个指向箭头,和圆角效果,怎么办呢?谢谢

------解决方案--------------------
document.getElementById( "dhtipscontent ").innerHTML = " <img src= " + tipStr + "> ";