怎么实现:当图片的面积大于所在table的width和height时,使之不撑大table也不用滚动条,只用手形状图标可以在table中移动图形,且保持图 following the example in this article, instead of moving the small window, you move the the image behindhttp://www.ebnet.com.cn/wangluo/texiao/tx39.htm 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你可以把图片作为背景来控制!,加上css属性,background-repeat:no-repeat,然后在鼠标移动的时候,通过background-position-x和background-position-y来控制图片! try somethinge like this (you need to change the image src):<script language="javascript">var width = 200;var height = 200;function document.onmousemove(){ var e = event.srcElement; if (e.tagName == "IMG" && e.id == "myimg") { var x = event.clientX - mytable.style.posLeft; var y = event.clientY - mytable.style.posTop; x = x*(myimg.width/width); y = y*(myimg.height/height); if (x > myimg.width - width) x = myimg.width-width; else if (x < 0) x=0; if (y> myimg.height-height ) y = myimg.height - height; else if (y<0) y=0; myimg.style.posLeft = -x; myimg.style.posTop = -y; }}function window.onload(){ mytable.style.clip = "rect(0 " + width + " " + height + " 0)";}</script><HTML><BODY><table STYLE="position:absolute;top:100;left:200;" id="mytable"><tr><td><IMG SRC="image.bmp" id="myimg" style="position:relative;top:0;left:0;"></td></tr></table> 楼上的狠,不过我想定制table的长宽怎么办啊,而且不要以绝对位置放啊。如<table width=300 height=300><tr><Td><!--希望效果在下面的表里生效--><table width=100% height=100%><Tr><td><img src=....></td></tr></table><!--end--></td></tr></table> 哪位牛人知道这样的用法是啥意思? 百度地图API设置全国搜索范围 2个obj值一样,为什么不能判断相等? JS粘贴的功能 滚动条的空位? 简单的问题 马上结贴 关注有份~~ 求助一个简单的问题 JS代码嵌入JS代码页面显示问题 新建窗口居中,怎么做? 怎样在javascript 代码段里保存jsp代码段里的Vector ***.jpg怎么取得jpg,这三个字符? JavaScript宝典(第四版)e文原电子版 有多少人要
background-repeat:no-repeat,
然后在鼠标移动的时候,通过background-position-x和background-position-y来控制图片!
<script language="javascript">
var width = 200;
var height = 200;function document.onmousemove()
{
var e = event.srcElement;
if (e.tagName == "IMG" && e.id == "myimg")
{
var x = event.clientX - mytable.style.posLeft;
var y = event.clientY - mytable.style.posTop; x = x*(myimg.width/width);
y = y*(myimg.height/height); if (x > myimg.width - width)
x = myimg.width-width;
else if (x < 0)
x=0; if (y> myimg.height-height )
y = myimg.height - height;
else if (y<0)
y=0; myimg.style.posLeft = -x;
myimg.style.posTop = -y;
}
}function window.onload()
{
mytable.style.clip = "rect(0 " + width + " " + height + " 0)";
}
</script>
<HTML>
<BODY>
<table STYLE="position:absolute;top:100;left:200;" id="mytable">
<tr><td>
<IMG SRC="image.bmp" id="myimg" style="position:relative;top:0;left:0;">
</td></tr>
</table>
如
<table width=300 height=300>
<tr><Td>
<!--希望效果在下面的表里生效-->
<table width=100% height=100%>
<Tr><td><img src=....></td></tr>
</table>
<!--end-->
</td></tr></table>