框架页面中鼠标拖动的问题

kelichen 2004-11-01 06:29:44
<html>
<body>
<script language="javascript">
var LastX;
function ReSize()
{
document.all('TdMenu').style.width=event.clientX+1;
window.status=event.clientX+','+LastX;
LastX=event.clientX;
}
function ReSizeAgain()
{
document.body.onmousemove=ReSize;
}
function ReSizeOver()
{
document.body.onmousemove=null;
}
document.body.onmouseup=ReSizeOver;
</script>
<table height="100%" cellSpacing="0" cellPadding="0" width="100%">
<tr>
<td id="TdMenu" bgColor="#f4f5f1" style="width:200" valign=top>menu</td>
<td width=2 bgcolor="cccccc" onmouseover="this.style.cursor='col-resize'" onmousedown="ReSizeAgain()"></td>
<td vAlign="top" align="center">
<iframe id="FrmList" name="FrmList" frameborder="0" width="99%" height="99%"></iframe>
</td>
</tr>
</table>
</form>
</body>
</html>

当鼠标移动速度很快的时候则onmouseup事件不能被触发,求解决方法
...全文
99 3 打赏 收藏 举报
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
ttyp 2004-11-01
  • 打赏
  • 举报
回复
<html>
<body>
<script language="javascript">
var LastX;
function ReSize()
{
document.all('TdMenu').style.width=event.clientX+1;
window.status=event.clientX+','+LastX;
document.body.setCapture();
LastX=event.clientX;

}
function ReSizeAgain()
{
document.body.onmousemove=ReSize;
}
function ReSizeOver()
{
document.body.releaseCapture();
document.body.onmousemove=null;
}
document.body.onmouseup=ReSizeOver;
</script>
<table height="100%" cellSpacing="0" cellPadding="0" width="100%">
<tr>
<td id="TdMenu" bgColor="#f4f5f1" style="width:200" valign=top>menu</td>
<td width=2 bgcolor="cccccc" onmouseover="this.style.cursor='col-resize'" onmousedown="ReSizeAgain()"></td>
<td vAlign="top" align="center">
<iframe id="FrmList" name="FrmList" frameborder="0" width="99%" height="99%"></iframe>
</td>
</tr>
</table>
</form>
</body>
</html>
fason 2004-11-01
  • 打赏
  • 举报
回复
var el
function ReSizeAgain()
{
el=event.srcElement;
.setCapture();
document.body.onmousemove=ReSize;
}
function ReSizeOver()
{
event.srcElement.releaseCapture()
document.body.onmousemove=null;
}



http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/setcapture.asp
fason 2004-11-01
  • 打赏
  • 举报
回复
var el
function ReSizeAgain()
{
el=event.srcElement;
el.setCapture();
document.body.onmousemove=ReSize;
}
function ReSizeOver()
{
if(!el)return;
el.releaseCapture()
document.body.onmousemove=null;
el=null
}



http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/methods/setcapture.asp
相关推荐
发帖
JavaScript

8.7w+

社区成员

Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
帖子事件
创建了帖子
2004-11-01 06:29
社区公告
暂无公告