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

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事件不能被触发,求解决方法
...全文
109 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
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

87,955

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧