function reWin() { var mngIfrm_div = $d("MngIfrm_div"); var rightIfrm_div = $d("rightIfrm_div"); var arrowright_div = $d("arrowright_div"); arrowright_div.className = "aw"; if(mngIfrm_div.style.display!="none") { mngIfrm_div.style.display="none"; arrowright_div.style.filter="fliph"; arrowright_div.title=txtEp; is_ext_mb = false; if(hasAds) { if(hasLrc || isAllyesExt) { arrowright_div.style.marginLeft="420px"; rightIfrm_div.style.display="inline"; } else { rightIfrm_div.style.display="none"; arrowright_div.style.marginLeft="0px"; showAdRight(arrBaiduAds[18]); $d("Lrc_div").style.marginLeft = "8"; window.moveTo((screen.width - 399) / 2, 0); window.resizeTo(399 + woffset, 600); } } else { rightIfrm_div.style.display="none"; $d("Lrc_div").style.marginLeft = "8"; window.moveTo((screen.width - 399) / 2, 0); window.resizeTo(399 + woffset, 600); } } else { $d("Lrc_div").style.marginLeft = "3"; if(screen.width > 800) window.moveTo(100, 0); else window.moveTo(0, 0); window.resizeTo(810 + woffset, 600); mngIfrm_div.style.display="inline"; rightIfrm_div.style.display="inline"; if(!isLoadIf) { search_location = search_location.replace("baidumt", "baidubox"); $d("try_iframe").src= search_location; try_iframe = window.frames[0]; isLoadIf = true; } $d("Blrc").style.display = "inline"; $d("LrcShower_div").style.display = "inline"; $d("lrctellall_div").style.display = "none"; arrowright_div.style.filter="normal"; arrowright_div.style.marginLeft="0px"; arrowright_div.title=txtTb; is_ext_mb = true; } if(hasAds){
$d('try_iframe').style.height = "225px";
}else{
$d('try_iframe').style.height = "520px";
} if (is_ext_mb) {
$d("leftAd_div").style.marginTop = "5px";
}
else {
if (isAllyesExt) {
$d("leftAd_div").style.display = "none";
$d("leftAd2_div").style.display = "";
$d("leftAd2_div").style.height = "430px";
$d("leftAd2_div").style.marginTop = "100px";
return true;
}
else {
$d("leftAd_div").style.marginTop = "230px";
}
}
$d("leftAd_div").style.display = "";
$d("leftAd2_div").style.display = "none";}
$d('try_iframe').style.height = "225px";
}else{
$d('try_iframe').style.height = "520px";
} if (is_ext_mb) {
$d("leftAd_div").style.marginTop = "5px";
}
else {
if (isAllyesExt) {
$d("leftAd_div").style.display = "none";
$d("leftAd2_div").style.display = "";
$d("leftAd2_div").style.height = "430px";
$d("leftAd2_div").style.marginTop = "100px";
return true;
}
else {
$d("leftAd_div").style.marginTop = "230px";
}
}
$d("leftAd_div").style.display = "";
$d("leftAd2_div").style.display = "none";}
*
js自适应改变窗口大小 * 发表日期:2009-6-30 浏览次数: * function reWin() { var mngIfrm_div = $d("MngIfrm_div"); var rightIfrm_div = $d("rightIfrm_div"); var arrowright_div = $d("arrowright_div"); arrowright_div.className = "aw"; if(mngIfrm_div.style.display!="none") { mngIfrm_div.style.display="none"; arrowright_div.style.filter="fliph"; arrowright_div.title=txtEp; is_ext_mb = false; if(hasAds) { if(hasLrc || isAllyesExt) { arrowright_div.style.marginLeft="420px"; rightIfrm_div.style.display="inline"; } else { rightIfrm_div.style.display="none"; arrowright_div.style.marginLeft="0px"; showAdRight(arrBaiduAds[18]); $d("Lrc_div").style.marginLeft = "8"; window.moveTo((screen.width - 399) / 2, 0); window.resizeTo(399 + woffset, 600); } } else { rightIfrm_div.style.display="none"; $d("Lrc_div").style.marginLeft = "8"; window.moveTo((screen.width - 399) / 2, 0); window.resizeTo(399 + woffset, 600); } } else { $d("Lrc_div").style.marginLeft = "3"; if(screen.width > 800) window.moveTo(100, 0); else window.moveTo(0, 0); window.resizeTo(810 + woffset, 600); mngIfrm_div.style.display="inline"; rightIfrm_div.style.display="inline"; if(!isLoadIf) { search_location = search_location.replace("baidumt", "baidubox"); $d("try_iframe").src= search_location; try_iframe = window.frames[0]; isLoadIf = true; } $d("Blrc").style.display = "inline"; $d("LrcShower_div").style.display = "inline"; $d("lrctellall_div").style.display = "none"; arrowright_div.style.filter="normal"; arrowright_div.style.marginLeft="0px"; arrowright_div.title=txtTb; is_ext_mb = true; } if(hasAds){
$d('try_iframe').style.height = "225px";
}else{
$d('try_iframe').style.height = "520px";
} if (is_ext_mb) {
$d("leftAd_div").style.marginTop = "5px";
}
else {
if (isAllyesExt) {
$d("leftAd_div").style.display = "none";
$d("leftAd2_div").style.display = "";
$d("leftAd2_div").style.height = "430px";
$d("leftAd2_div").style.marginTop = "100px";
return true;
}
else {
$d("leftAd_div").style.marginTop = "230px";
}
}
$d("leftAd_div").style.display = "";
$d("leftAd2_div").style.display = "none"; }
根据内容自动调整弹出窗口大小的JS 解决方案 在弹出窗口时,根据窗口的内容来自动调节窗口的大小,窗口如果已经和屏幕相等大小时则出现滚动条。
解决方案
在弹出的页面中添加一JS脚本方法win_onLoad(),在body的onload方法中引用win_onLoad(),在body中添加表,表的 id取名为tbllist,窗口的大小就是这个table的大小在宽和高上分别加50。
窗口弹出时,父窗口设定的大小如果小于500的则弹出的窗口为500,大于的则是原来大小,弹出窗口的内容如果大于本来的大小则自适应窗口的大小。部分代码如下:
子页面b.html代码:
根据内容自动调整弹出窗口大小的JS解决方案<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
根据内容自动调整弹出窗口大小的JS解决方案<html xmlns="http://www.w3.org/1999/xhtml">
根据内容自动调整弹出窗口大小的JS解决方案根据内容自动调整弹出窗口大小的JS解决方案<script language=javascript>根据内容自动调整弹出窗口大小的JS解决方案
根据内容自动调整弹出窗口大小的JS解决方案//
根据内容自动调整弹出窗口大小的JS解决方案根据内容自动调整弹出窗口大小的JS解决方案function win_onLoad()根据内容自动调整弹出窗口大小的JS解决方案{
根据内容自动调整弹出窗口大小的JS解决方案 var width = document.all["tblList"].offsetWidth;
根据内容自动调整弹出窗口大小的JS解决方案 var height = document.all["tblList"].offsetHeight;
根据内容自动调整弹出窗口大小的JS解决方案
根据内容自动调整弹出窗口大小的JS解决方案 width = eval_r(width + 50);
根据内容自动调整弹出窗口大小的JS解决方案 height = eval_r(height + 50);
根据内容自动调整弹出窗口大小的JS解决方案
根据内容自动调整弹出窗口大小的JS解决方案 if (width < 500)
根据内容自动调整弹出窗口大小的JS解决方案 width = 500;
根据内容自动调整弹出窗口大小的JS解决方案 else if (width > screen.width)
根据内容自动调整弹出窗口大小的JS解决方案 width = screen.width;
根据内容自动调整弹出窗口大小的JS解决方案
根据内容自动调整弹出窗口大小的JS解决方案 if (height < 500)
根据内容自动调整弹出窗口大小的JS解决方案 height = 500;
根据内容自动调整弹出窗口大小的JS解决方案 else if (height > screen.height)
根据内容自动调整弹出窗口大小的JS解决方案 height = screen.height;
根据内容自动调整弹出窗口大小的JS解决方案
根据内容自动调整弹出窗口大小的JS解决方案 window.resizeTo(width,height);
根据内容自动调整弹出窗口大小的JS解决方案}
根据内容自动调整弹出窗口大小的JS解决方案</script>
根据内容自动调整弹出窗口大小的JS解决方案
根据内容自动调整弹出窗口大小的JS解决方案<head></head>
根据内容自动调整弹出窗口大小的JS解决方案<BODY bgcolor="0099CC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" onLoad="win_onLoad();">
根据内容自动调整弹出窗口大小的JS解决方案<TABLE width="95%" border="0" cellpadding="0" cellspacing="0" class="table-left1-right2" style="border:1 solid #000000" id="tblList">
根据内容自动调整弹出窗口大小的JS解决方案<TR>
根据内容自动调整弹出窗口大小的JS解决方案<TD width="100%" valign="top" colspan=2>
根据内容自动调整弹出窗口大小的JS解决方案 欢迎使用!
根据内容自动调整弹出窗口大小的JS解决方案</TD>
根据内容自动调整弹出窗口大小的JS解决方案</TR>
根据内容自动调整弹出窗口大小的JS解决方案</TABLE>
根据内容自动调整弹出窗口大小的JS解决方案</BODY>
根据内容自动调整弹出窗口大小的JS解决方案</html>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script src="http://img.jb51.net/jslib/jquery/jquery-1.3.2.min.js"></script>
<script type="text/javascript"><!--
$(function() {
$("#12").click(function() {
if ($(this).attr("checked") == true) { // 全选
$("input[name='11']").each(function() {
$(this).attr("checked", true);
});
} else { // 取消全选
$("input[name='11']").each(function() {
$(this).attr("checked", false);
});
}
});
});
// -->
</script>
</HEAD> <BODY>
<table>
<tr>
<td><!--
<input type='checkbox' name='checkbox_name[]' id='checkbox_name_1' />1<br />
<input type='checkbox' name='checkbox_name[]' id='checkbox_name_2' />2<br />
<input type='checkbox' name='checkbox_name[]' id='checkbox_name_3' />3<br />
<input type='checkbox' name='checkbox_name[]' id='checkbox_name_4'/>4<br /> -->
<input type='checkbox' name='11' id='checkbox_name_1' />1<br />
<input type='checkbox' name='11' id='checkbox_name_2' />2<br />
<input type='checkbox' name='11' id='checkbox_name_3' />3<br />
<input type='checkbox' name='11' id='checkbox_name_4'/>4<br /> <input type='checkbox' name='checkedAll' id='12' />全选/取消全选
</td>
</tr>
</table>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script src="jquery-1.4.2.js"></script><script type="text/javascript">
$(document).ready( function() {
sl("#12");
});function sl(id) {
$("A[href='"+id+"']").click( function() {
if ($("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked') == false) {
$("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked', true);
} else {
$("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked', false);
}
});
}
</script>
</HEAD> <BODY>
<table>
<tr>
<td>
<fieldset id="1112">
<input type='checkbox' name='11' id='checkbox_name_1' />1<br />
<input type='checkbox' name='11' id='checkbox_name_2' />2<br />
<input type='checkbox' name='11' id='checkbox_name_3' />3<br />
<input type='checkbox' name='11' id='checkbox_name_4'/>4<br />
</fieldset><a rel="1112" href="#12">全选/取消全选</a>
</td>
</tr>
</table>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
<META NAME="Keywords" CONTENT="">
<META NAME="Description" CONTENT="">
<script src="jquery-1.4.2.js"></script><script type="text/javascript">
$(document).ready( function() {
for(var i = 0 ; i < $("a[href]").size(); i ++ ){
//alert($("a:eq("+i+")").attr("href"));
sl($("a:eq("+i+")").attr("href"));
}
});function sl(id) {
$("A[href='"+id+"']").click( function() {
if ($("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked') == false) {
$("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked', true);
} else {
$("#" + $(this).attr('rel') + " INPUT[type='checkbox']").attr('checked', false);
}
});
}
</script>
</HEAD> <BODY>
<table>
<tr>
<td>
<fieldset id="1112">
<input type='checkbox' name='110' id='checkbox_name_1' />1<br />
<input type='checkbox' name='110' id='checkbox_name_2' />2<br />
<input type='checkbox' name='110' id='checkbox_name_3' />3<br />
<input type='checkbox' name='110' id='checkbox_name_4'/>4<br />
</fieldset>
<a rel="1112" href="#12">全选/取消全选</a><br /><fieldset id="1113">
<input type='checkbox' name='111' id='checkbox_name_1' />1<br />
<input type='checkbox' name='111' id='checkbox_name_2' />2<br />
<input type='checkbox' name='111' id='checkbox_name_3' />3<br />
<input type='checkbox' name='111' id='checkbox_name_4'/>4<br />
</fieldset>
<a rel="1113" href="#13">全选/取消全选</a>
</td>
</tr>
</table>
</BODY>
</HTML>