IE5.5+能用<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var curElement,wx,wy,cx,cy,sx,sy,px,py;
var oeventX,oeventY;
//=============================================
function doMouseDown()
{
if ((event.button==1) && (event.srcElement.id=="oframe"))curElement = event.srcElement;oeventX1=event.clientX;
oeventY1=event.clientY;
}function doMouseMove(){
if ((event.button==1) && (curElement!=null)){
// 定位图层
newleft= oframe.offsetLeft+(event.clientX-oeventX1);var obj=document.elementFromPoint(curElement.style.pixelLeft,curElement.style.pixelTop)
if(obj.tagName=="TD")obj.fireEvent("onmouseout"); if (newleft<0){newleft=0;}//自动调整层横坐标位置
curElement.style.pixelLeft=newleft;
oeventX1=event.clientX; newtop=oframe.offsetTop+(event.clientY-oeventY1);
if (newtop<0){newtop=0;}//自动调整层纵坐标位置
curElement.style.pixelTop= newtop;
oeventY1=event.clientY;
event.returnValue = false;
event.cancelBubble = true;var obj=document.elementFromPoint(curElement.style.pixelLeft,curElement.style.pixelTop)
if(obj.tagName=="TD")obj.fireEvent("onmouseover");
}
}function window.onload(){
document.onmousedown = doMouseDown;
document.onmousemove = doMouseMove;
document.onmouseup = new Function("curElement =null")
}
//-->
</SCRIPT>
<style type="text/css">
<!--
.tdChangeColor {behavior:url(tdChangeColor.htc)}
-->
</style>
</HEAD><BODY BGCOLOR="#FFFFFF">
<div id="oframe" style="position:absolute;left:10;top:30;width:40;background-color:#cccccc">aaaaaaa</div><table width="300" border="1" cellspacing="3" cellpadding="3">
<tr>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td class="tdChangeColor"> </td>
</tr>
<tr>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
<td> </td>
</tr>
</table></BODY>
</HTML>
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var curElement,wx,wy,cx,cy,sx,sy,px,py;
var oeventX,oeventY;
//=============================================
function doMouseDown()
{
if ((event.button==1) && (event.srcElement.id=="oframe"))curElement = event.srcElement;oeventX1=event.clientX;
oeventY1=event.clientY;
}function doMouseMove(){
if ((event.button==1) && (curElement!=null)){
// 定位图层
newleft= oframe.offsetLeft+(event.clientX-oeventX1);var obj=document.elementFromPoint(curElement.style.pixelLeft,curElement.style.pixelTop)
if(obj.tagName=="TD")obj.fireEvent("onmouseout"); if (newleft<0){newleft=0;}//自动调整层横坐标位置
curElement.style.pixelLeft=newleft;
oeventX1=event.clientX; newtop=oframe.offsetTop+(event.clientY-oeventY1);
if (newtop<0){newtop=0;}//自动调整层纵坐标位置
curElement.style.pixelTop= newtop;
oeventY1=event.clientY;
event.returnValue = false;
event.cancelBubble = true;var obj=document.elementFromPoint(curElement.style.pixelLeft,curElement.style.pixelTop)
if(obj.tagName=="TD")obj.fireEvent("onmouseover");
}
}function window.onload(){
document.onmousedown = doMouseDown;
document.onmousemove = doMouseMove;
document.onmouseup = new Function("curElement =null")
}
//-->
</SCRIPT>
<style type="text/css">
<!--
.tdChangeColor {behavior:url(tdChangeColor.htc)}
-->
</style>
</HEAD><BODY BGCOLOR="#FFFFFF">
<div id="oframe" style="position:absolute;left:10;top:30;width:40;background-color:#cccccc">aaaaaaa</div><table width="300" border="1" cellspacing="3" cellpadding="3">
<tr>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td class="tdChangeColor"> </td>
</tr>
<tr>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
<td> </td>
</tr>
</table></BODY>
</HTML>
解决方案 »
- 急急急!IE和ipad浏览器的区别
- 为什么不能赋值?
- 二级联动如何设置默认值
- 带“checkbox”的树型人员选择JS,请meizz,fason,hbhbhbhbhb1021在完善一下!谢谢!
- [100分]求同父域下相互通信的问题.data.163.com与www.163.com之间通信
- 在网页中插入音频有什么好的办法吗?兼容ie7以上的
- js数组分割问题
- http://mobile.real.com/? 左边的菜单点样做?
- 为什么parseInt的结果是这样啊?
- textarea可以输入多少bytes数据?
- 如何指向 xx frameset 的 src ?
- 请问一个表框填好后,能不能同时存入一个变量中?
<HEAD>
<TITLE> New Document </TITLE>
<SCRIPT LANGUAGE="JavaScript">
<!--
var curElement,wx,wy,cx,cy,sx,sy,px,py;
var oeventX,oeventY;
//=============================================
function doMouseDown()
{
if ((event.button==1) && (event.srcElement.id=="oframe"))curElement = event.srcElement;oeventX1=event.clientX;
oeventY1=event.clientY;
}function doMouseMove(){
if ((event.button==1) && (curElement!=null)){
// 定位图层
newleft= oframe.offsetLeft+(event.clientX-oeventX1);var obj=document.elementFromPoint(curElement.style.pixelLeft,curElement.style.pixelTop)
if(obj.tagName=="TD")obj.runtimeStyle.backgroundColor=''; if (newleft<0){newleft=0;}//自动调整层横坐标位置
curElement.style.pixelLeft=newleft;
oeventX1=event.clientX; newtop=oframe.offsetTop+(event.clientY-oeventY1);
if (newtop<0){newtop=0;}//自动调整层纵坐标位置
curElement.style.pixelTop= newtop;
oeventY1=event.clientY;
event.returnValue = false;
event.cancelBubble = true;var obj=document.elementFromPoint(curElement.style.pixelLeft,curElement.style.pixelTop)
if(obj.tagName=="TD")obj.runtimeStyle.backgroundColor='#ff0000'; }
}function window.onload(){
document.onmousedown = doMouseDown;
document.onmousemove = doMouseMove;
document.onmouseup = new Function("curElement =null")
}
//-->
</SCRIPT>
<style type="text/css">
<!--
.tdChangeColor {behavior:url(tdChangeColor.htc)}
-->
</style>
</HEAD><BODY BGCOLOR="#FFFFFF">
<div id="oframe" style="position:absolute;left:10;top:30;width:40;background-color:#cccccc">aaaaaaa</div><table width="300" border="1" cellspacing="3" cellpadding="3">
<tr>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td class="tdChangeColor"> </td>
</tr>
<tr>
<td class="tdChangeColor"> </td>
<td class="tdChangeColor"> </td>
<td> </td>
</tr>
</table></BODY>
</HTML>
document.elementFromPoint(curElement.style.pixelLeft,curElement.style.pixelTop)
原来是htc不能响应那样子fire的事件?^o^ 好用了 加分