我在做一个项目,借用了一个拖动程序,在ID为mbox_*的DIV里放内容,可以实现该内容的拖动,可是放的内容为iframe时,向下拖动就会出现停滞、不流畅的现象,好像鼠标的焦点跑到了iframe上,请问有什么办法能解决此问题?
代码如下,中间一列的内容拖动不流畅,右侧的内容拖动很流畅,请帮忙看一下,不甚感谢:
a1.html<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title></title>
<style>
.nullbox {position:relative;width:1px;height:1px;}
body,td,a,p,.h{font-family:arial,sans-serif;}
h2.modtitle {width:100%;padding-top:0px;padding-bottom:0px;margin: 0em;font-size:100%;font-weight:normal;}
.modbox {margin-bottom:10px;border:1px solid #929292;background-color:white;}
#td_0 {width:16%;vertical-align:top;}
#td_1,#td_2{width:40%;vertical-align:top;}
.boxhead {width:100%;padding:0px;margin:0px;font-size:82%;}
.bhleft {width:90%;background-color:#c9d7f1;padding-left:2px;font-weight:bold;padding-right:5px;font-size:122%;}
.bhlefta {overflow:hidden;height:1.2em;}
</style>
<script src="google_drag.js"></script>
</head>
<body onload="start()" bgcolor=#ffffff text=#000000 topmargin=0 leftmargin=0 marginheight=3>
<br />
<center>
<table cellpadding=0 cellspacing=0 border=0 width=1000 height=100%>
<tr>
<td valign=top width=100%>
<div>
<table id=t_1 cellspacing=5 border=0 width=100% align=center style="table-layout:fixed;">
<tr>
<td id=td_0>
<div id=box_0 class=modbox style="position:relative">
<h2 class=modtitle>
<table class=boxhead cellspacing=0 cellpadding=0>
<tr>
<td id=box_0_h class=bhleft><a class=bhlefta id=box_0_url  style="color:#ff6600;">目录</a></td>
</tr>
</table>
</h2>
<div id=mbox_0>
<div>
</div>
</div>
</div>
<div class=nullbox></div>
</td>
<td id=td_1>
<div id=box_1 class=modbox style="position:relative">
<h2 class=modtitle>
<table class=boxhead cellspacing=0 cellpadding=0>
<tr>
<td id=box_1_h class=bhleft><a class=bhlefta id=box_1_url style="color:#aa0033;">第一</a></td>
</tr>
</table>
</h2>
<div id=mbox_1>
<div>
<iframe src="http://www.baidu.com" width="385" height="136" hspace="1" marginwidth="1" frameborder="0" scrolling="no"></iframe>
</div>
</div>
</div>
<div id=box_3 class=modbox style="position:relative">
<h2 class=modtitle>
<table class=boxhead cellspacing=0 cellpadding=0>
<tr>
<td id=box_3_h class=bhleft><a class=bhlefta id=box_3_url style="color:#008000;">第二</a></td>
</tr>
</table>
</h2>
<div id=mbox_3>
<div>
<iframe src="http://www.sina.com.cn" width="400" hspace="1" marginwidth="1" frameborder="0" scrolling="no" height="152"></iframe>
</div>
</div>
</div> <div class=nullbox></div>
</td>
<td id=td_2>
<div id=box_2 class=modbox style="position:relative">
<h2 class=modtitle>
<table class=boxhead cellspacing=0 cellpadding=0>
<tr>
<td id=box_2_h class=bhleft><a class=bhlefta id=box_3_url style="color:#008000;">第三</a></td>
</tr>
</table>
</h2>
<div id=mbox_2>
<div>内容一</div>
<div>内容二</div>
<div>内容三</div>
</div>
</div>
<div id=box_4 class=modbox style="position:relative">
<h2 class=modtitle>
<table class=boxhead cellspacing=0 cellpadding=0>
<tr>
<td id=box_4_h class=bhleft><a class=bhlefta id=box_5_url style="color:#008000;">第四</a></td>
</tr>
</table>
</h2>
<div id=mbox_4>
<div>内容一</div>
<div>内容二</div>
<div>内容三</div>
</div>
</div>
<div class=nullbox></div>
</td>
</tr>
</table>
</div>
<center>
<br>
<div align=center style="white-space:nowrap"><font size=-1><a href="#">信息中心</a> - <a href="#">相关政策</a></font>
<p><font size=-2>&copy;2009 </font>
</div>
</center>
</td>
</tr>
</table>
</center>
<script>
//google的页面里可以拖动的部分的id是"t_1"
_table=document.getElementById("t_1");
//挂载到onload,载入完毕执行。不过实际上google没有用onload。
//而是写在页面最下面,异曲同工吧,也许直接写在页面是种怪癖,或者也有可能是兼容性考虑。
//行了,你可以自己下载一个google ig的页面了,把里面的所有script删除挂上这个js也可以拖拽了,哈哈
//其实看懂这些代码对学习javascript很有益,希望对大家能有帮助
window.onload = function (){ _IG_initDrag(_table)};
</script>
</body>
</html>google_drag.js
http://d.namipan.com/d/e27d8998b8c618d8b816cd7c03e3efbb0ae7b66e242e0000  内容太多,我放到纳米盘上下载

解决方案 »

  1.   

    <div id=mbox_3> 
    <div> 
    <iframe src="http://www.sina.com.cn" width="400" hspace="1" marginwidth="1" frameborder="0" scrolling="no" height="152"> </iframe> 
    </div> 
    </div> 要拖动的iframe是这段话吧。你的意思是,把iframe换成div框就可实现拖动,换成iframe就拖动不流畅了,但是也能拖动是吧!那样的话,你是这加上这样一个div框。<div id=mbox_3> 
        <div id="title_id">
        鼠标放到这里可以拖动哦!------------- 关闭
        </div> 
        <div id="body_id">
            <iframe src="http://www.sina.com.cn" width="400" hspace="1" marginwidth="1" frameborder="0" scrolling="no" height="152"> </iframe> 
        </div> 
    </div>换成这样的试一下。 
    <div id="title_id">
        鼠标放到这里可以拖动哦!------------- 关闭
    </div>  
      

  2.   

    如果还是不行的话,你可以加我的QQ:285207813,或者到我的百度空间 http://hi.baidu.com/ai_zxc 给我留言。我们在一起讨论这、解决个问题。