日期:2014-05-16  浏览次数:20356 次

请问怎样记住上次 框被拉伸的数值?
如下面的两个框,如果手工将左边的框宽度拉为400,那么下次再打开这文件,怎样让左边框的宽度自动调整为400?   最好有代码例子,先谢谢了.

 
    <frameset   cols= "220,* "   frameborder= "1 "   >
            <frame   name= "detail "   src= "sss.html ">
            <frame   name= "main "     src= "kdk.html ">
      </frameset>

------解决方案--------------------
两个文件
1.htm
<frameset cols= "220,* " frameborder= "1 " name= "HBHBFrame ">
<frame name= "detail " src= "3.htm ">
<frame name= "main " src= "2.htm ">
</frameset>

3.htm
<script language=javascript defer>
function getCookieVal(offset) {
var endstr = document.cookie.indexOf ( "; ", offset);
if (endstr == -1) {
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}

function setCookie(name, value, expires, path, domain, secure) {
document.cookie = name + "= " + escape (value) +
((expires) ? "; expires= " + expires : " ") +
((path) ? "; path= " + path : " ") +
((domain) ? "; domain= " + domain : " ") +
((secure) ? "; secure " : " ");
}
function getCookie(name) {
var arg = name + "= ";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg) {
return getCookieVal(j);
}
i = document.cookie.indexOf( " ", i) + 1;
if (i == 0) break;
}
return " ";
}
function deleteCookie(name,path,domain) {
if (getCookie(name)) {
document.cookie = name + "= " +
((path) ? "; path= " + path : " ") +
((domain) ? "; domain= " + domain : " ") +
"; expires=Thu, 01-Jan-70 00:00:01 GMT ";
}
}
var oldCols=getCookie( "HBCol ")
if(oldCols)
top.HBHBFrame.cols=oldCols;
function setCols()
{
setCookie( "HBCol ",top.HBHBFrame.cols)
}
</script>
<body onunload=setCols()>
</body>