[100分],求:按住鼠标左键滑过表格,表格的单元格或行响应什么事件?在线,对了立即给分. 想实现如下效果:按住鼠标左键滑过表格时,被滑过的表格中CheckList被选中.我不知道响应什么事件?我在线,对了立即给分. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 onselect事件但仅针对document.body表格不支持该事件 有难度. 应该是onselect事件在释放选择时触发. 然后通过用selection来修改check的属性 onmousedown + onmousemove + onmouseup 如果要精确到在某一table的td里,用这个onmousedown + onmousemove + onmouseup组合比较好 很难的说,可能onkeydown不再table触发。不好掌握。 大致触发了这几个事件body onmousemove onselectstart #ie table oumouseover onmousemove onselectstart #ie 昂,还有内部的table内部元素的 oumouseover onmousemove onselectstart #ie onmousedown: 纪录起始位置onmousemove:onmouseup:选中,或取消 <font color=red style="background-color:#cccccc;width:200px;" onmousemove="if(event.fromElement!=this && event.button)alert(event.button)" >ddd</font> onmousedown + onmousemove + onmouseup <div id="tip" style="width:200px; line-height:22px; border:1px solid #FF0000;"></div><table id="tab1" border="1" width=200> <tr id="tr1"> <td id="td1"> <input type="checkbox" name="c1" id="c1"> </td> </tr> <tr id="tr2"> <td id="td2"> <input type="checkbox" name="c2" id="c2"> </td> </tr></table><script>function $(o){return document.getElementById(o)}function info(event){ var e = window.event?window.event:event; var eobj = window.event?window.event.srcElement:event.target; alert(e.button) if(window.event){//ie if(e.button == 1){ $("tip").innerHTML = eobj.id; } } else{ if(e.button == 0){ $("tip").innerHTML = eobj.id; } }}document.onmousemove = info;document.onmousedown = info;//document.onmouseup = info; 当在table里mousemove+mousedown时记录开始和结束的坐标再用document.elementFromPoint(x,y)得到当前所有控件。如果是checkbox. 帮助我看看下面代码,并帮我修改一下 求javascript 大侠帮助 解决这个问题 我的一个JS方法问题,为什么我动态添加一个<img>出现了下面的问题 一个输入框显示剩余数字的问题,大虾们.请指教 求一个正则表达式问题??替换指定的字符 如何相对定位DIV在一屏页面的中间? 怎么消除热点的边框? javascript不是很懂,想实现一个小功能 如何能实现在客户端判断多个站点哪个是开了的,然后跳转到开了的站点? ————————请教————————! 请问高手这种功能怎么实现?帮忙看看 在PHOTOSHOP里怎样画一个有边框的矩形啊
但仅针对document.body
表格不支持该事件
不好掌握。
body
onmousemove
onselectstart #ie
table
oumouseover
onmousemove
onselectstart #ie
table内部元素的
oumouseover
onmousemove
onselectstart #ie
onmousemove:
onmouseup:选中,或取消
<table id="tab1" border="1" width=200>
<tr id="tr1">
<td id="td1">
<input type="checkbox" name="c1" id="c1">
</td>
</tr>
<tr id="tr2">
<td id="td2">
<input type="checkbox" name="c2" id="c2">
</td>
</tr>
</table>
<script>
function $(o){return document.getElementById(o)}
function info(event){
var e = window.event?window.event:event;
var eobj = window.event?window.event.srcElement:event.target;
alert(e.button)
if(window.event){//ie
if(e.button == 1){
$("tip").innerHTML = eobj.id;
}
}
else{
if(e.button == 0){
$("tip").innerHTML = eobj.id;
}
}
}
document.onmousemove = info;
document.onmousedown = info;
//document.onmouseup = info;
再用document.elementFromPoint(x,y)得到当前所有控件。如果是checkbox.