关于包含Iframe的页面分栏拖动的问题。 不知道怎么的 ,只要页面存在Ifrmae 分栏的拖动就变的很慢。】第一次的拖动还行,第二次就获取不到鼠标的位置了、 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <script type="text/javascript"> var _winWidth = 180; var _winHeight = 575; /*******************************/ /***** Colmid (CM) Object *****/ /*******************************/ function CM() { } CM.mouseover = function(p_o) { p_o.style.backgroundColor = "#549FE3"; } CM.mouseout = function(p_o) { p_o.style.backgroundColor = "#FFFFFF"; } CM.mousedown = function(p_ev) { p_ev = (p_ev) ? p_ev : event; CM.ismousedown = true; CM.currpos = p_ev.clientX; CM.currLeftW = CM.getCurrLeftW(); document.body.style.cursor = 'col-resize'; return false; } CM.mouseup = function() { CM.ismousedown = false; document.body.style.cursor = 'auto'; CM.currLeftW = parseInt(document.getElementById("colleft").style.width); return false; } CM.mousemove = function(p_ev) { if (CM.ismousedown) { p_ev = (p_ev) ? p_ev : event; var newpos = p_ev.clientX; var pxmoved = parseInt(newpos - CM.currpos); pxmoved = (document.body.dir == 'rtl') ? -pxmoved : pxmoved; var newLeftW = parseInt(CM.currLeftW + pxmoved); var newRightW = getWinWidth() - newLeftW - CM.rightWAdj; if (newLeftW >= CM.minLeft && newRightW >= CM.minRight) { document.getElementById("colleft").style.width = newLeftW + 'px'; } return false } else return true; } CM.setMinLeft = function() { CM.minLeft = 1; } CM.getCurrRightW = function() { return getWinWidth() - CM.getCurrLeftW() - CM.rightWAdj; } CM.getCurrLeftW = function() { if (CM.currLeftW == 0) CM.currLeftW = parseInt(document.getElementById("colleft").style.width); return CM.currLeftW; } CM.ismousedown; CM.currpos; CM.currLeftW = 0; CM.minLeft; CM.minRight = 920; CM.rightWAdj = 21; //8+8+5 /***** End Colmid (CM) Object *****/ function getElemHeight(p_el) { if (p_el.innerHeight) return p_el.innerHeight; else if (p_el.clientHeight) return p_el.clientHeight; else return p_el.offsetHeight; } function getWinHeight() { if (window.innerHeight) return window.innerHeight; else if (document.documentElement.clientHeight) return document.documentElement.clientHeight; else if (document.body.offsetHeight) return document.body.offsetHeight; else return _winHeight; } function getWinWidth() { if (window.innerWidth) return window.innerWidth; else if (document.documentElement.clientWidth) return document.documentElement.clientWidth; else if (document.body.offsetWidth) return document.body.offsetWidth; else return _winWidth; } function HandleOnLoad() { CM.setMinLeft(); } /***** Attach events *****/ window.onload = HandleOnLoad; /* function hiddenOrDisplayLeft() { if (document.getElementById('Left').style.display == "none") { document.getElementById('Left').style.display = 'block'; document.getElementById('hiddenImg').src = "../../img/btn_right_img.gif"; } else { document.getElementById('Left').style.display = 'none'; document.getElementById('hiddenImg').src = "../../img/btn_left_img.gif"; } } */ $(function() { $("#Header_list_LegClassLabel").addClass("BGColor"); }) </script> <body style="margin: 0px;" dir="ltr" onmouseup="return CM.mouseup();" onmousemove="return CM.mousemove(event);"> <form id="form1" runat="server"> <uc1:Header ID="Header" runat="server" /> <div align="center"> <center> <table border="0" cellspacing="0" cellpadding="0" style="width: 1280px; height: 100%"> <tr> <td align="left" id="colleft" style="width: 195px;"> <iframe frameborder="0" id="I1" name="I1" src="LeftTree.aspx" class="main_iframe" allowtransparency="true"></iframe> </td> <td style="width: 1px; cursor: col-resize;" id="colmid" onmouseover="CM.mouseover(this)" onmouseout="CM.mouseout(this)" onmousedown="return CM.mousedown(event)" onmouseup="return CM.mouseup();"> </td> <td id="colright" style="height: 650px"> <iframe frameborder="0" id="I2" name="I2" scrolling="yes" src="DataShow.aspx" class="main_iframe"> </iframe> </td> </tr> </table> </center> </div> </form></body> <style type="text/css"> .left_iframe { width: 180px; height: 92%; background: transparent; } .main_iframe { z-index: 1; width: 100%; height: 650px; } </style> html什么都不用改,只写一个引用JS的语句,任何页面只要引用了这个JS,页面上就可以悬浮一个图片,请问这个JS怎么写? 幫我看下這段代碼 帮帮忙! Prototype.js 问题 请高手进来帮我看看这跟随IE移动图层的问题! JS 传值(字符) .急,帮忙,谢谢 大家来说说都用什么工具去写html。js这些web前端的 如何获得存放网页的主机的IP或域名? 银行系统中javascript运用. jquery. datatables 加删除链接问题 小问题,你懂的~~~谢谢您啦 网页隐藏部分代码问题
var _winWidth = 180;
var _winHeight = 575;
/*******************************/
/***** Colmid (CM) Object *****/
/*******************************/
function CM() { }
CM.mouseover = function(p_o) { p_o.style.backgroundColor = "#549FE3"; }
CM.mouseout = function(p_o) { p_o.style.backgroundColor = "#FFFFFF"; }
CM.mousedown = function(p_ev) {
p_ev = (p_ev) ? p_ev : event;
CM.ismousedown = true;
CM.currpos = p_ev.clientX;
CM.currLeftW = CM.getCurrLeftW();
document.body.style.cursor = 'col-resize';
return false;
}
CM.mouseup = function() {
CM.ismousedown = false;
document.body.style.cursor = 'auto';
CM.currLeftW = parseInt(document.getElementById("colleft").style.width);
return false;
}
CM.mousemove = function(p_ev) {
if (CM.ismousedown) {
p_ev = (p_ev) ? p_ev : event;
var newpos = p_ev.clientX;
var pxmoved = parseInt(newpos - CM.currpos);
pxmoved = (document.body.dir == 'rtl') ? -pxmoved : pxmoved;
var newLeftW = parseInt(CM.currLeftW + pxmoved);
var newRightW = getWinWidth() - newLeftW - CM.rightWAdj;
if (newLeftW >= CM.minLeft && newRightW >= CM.minRight) {
document.getElementById("colleft").style.width = newLeftW + 'px';
}
return false
} else return true;
}
CM.setMinLeft = function() {
CM.minLeft = 1;
}
CM.getCurrRightW = function() {
return getWinWidth() - CM.getCurrLeftW() - CM.rightWAdj;
}
CM.getCurrLeftW = function() {
if (CM.currLeftW == 0) CM.currLeftW = parseInt(document.getElementById("colleft").style.width);
return CM.currLeftW;
}
CM.ismousedown;
CM.currpos;
CM.currLeftW = 0;
CM.minLeft;
CM.minRight = 920;
CM.rightWAdj = 21; //8+8+5
/***** End Colmid (CM) Object *****/ function getElemHeight(p_el) {
if (p_el.innerHeight) return p_el.innerHeight;
else if (p_el.clientHeight) return p_el.clientHeight;
else return p_el.offsetHeight;
}
function getWinHeight() {
if (window.innerHeight) return window.innerHeight;
else if (document.documentElement.clientHeight) return document.documentElement.clientHeight;
else if (document.body.offsetHeight) return document.body.offsetHeight;
else return _winHeight;
}
function getWinWidth() {
if (window.innerWidth) return window.innerWidth;
else if (document.documentElement.clientWidth) return document.documentElement.clientWidth;
else if (document.body.offsetWidth) return document.body.offsetWidth;
else return _winWidth;
}
function HandleOnLoad() {
CM.setMinLeft();
}
/***** Attach events *****/
window.onload = HandleOnLoad; /*
function hiddenOrDisplayLeft() {
if (document.getElementById('Left').style.display == "none") {
document.getElementById('Left').style.display = 'block';
document.getElementById('hiddenImg').src = "../../img/btn_right_img.gif";
} else {
document.getElementById('Left').style.display = 'none';
document.getElementById('hiddenImg').src = "../../img/btn_left_img.gif";
}
}
*/
$(function() {
$("#Header_list_LegClassLabel").addClass("BGColor");
})
</script>
<form id="form1" runat="server">
<uc1:Header ID="Header" runat="server" />
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="0" style="width: 1280px; height: 100%">
<tr>
<td align="left" id="colleft" style="width: 195px;">
<iframe frameborder="0" id="I1" name="I1" src="LeftTree.aspx" class="main_iframe"
allowtransparency="true"></iframe>
</td>
<td style="width: 1px; cursor: col-resize;" id="colmid" onmouseover="CM.mouseover(this)"
onmouseout="CM.mouseout(this)" onmousedown="return CM.mousedown(event)" onmouseup="return CM.mouseup();">
</td>
<td id="colright" style="height: 650px">
<iframe frameborder="0" id="I2" name="I2" scrolling="yes" src="DataShow.aspx" class="main_iframe">
</iframe>
</td>
</tr>
</table>
</center>
</div>
</form>
</body>
.left_iframe
{
width: 180px;
height: 92%;
background: transparent;
}
.main_iframe
{
z-index: 1;
width: 100%;
height: 650px;
}
</style>