标签:
杂谈 |
分类: JS学习班 |
一个页面分左右两部分..左右两边里套用框架(里面分别包含一个新页面),要实现当鼠标在左边区域时右边框架就隐藏,反之也是。。。。。。。。
效果图:

<script>// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
var p, i, foundObj;
if(!theDoc) theDoc = document;
if( (p = theObj.indexOf("?")) > 0
&& parent.frames.length)
{
theDoc =
parent.frames[theObj.substring(p+1)].document;
theObj =
theObj.substring(0,p);
}
if(!(foundObj = theDoc[theObj])
&& theDoc.all) foundObj =
theDoc.all[theObj];
for (i=0; !foundObj
&& i <
theDoc.forms.length; i++)
foundObj =
theDoc.forms[i][theObj];
for(i=0; !foundObj
&& theDoc.layers
&& i <
theDoc.layers.length; i++)
foundObj =
findObj(theObj,theDoc.layers[i].document);
if(!foundObj &&
document.getElementByIdx) foundObj =
document.getElementByIdx(theObj);
return foundObj;
}
</script>
<style type="text/css">
<!--
body {
margin:
0px;
background-color: buttonface;
overflow:
hidden;
border:
0px;
}
.ctrlbar {
border: 1px
inset;
}
.explorer {
background-color: #FFFFFF;
border: 1px
inset;
}
.ctbutton {
font-family:
Arial, Helvetica, sans-serif;
font-size:
8px;
background-color: #eeeeee;
border-width: 1px;
width:
9px;
height:
100px;
margin-bottom: 100px;
}
-->
</style>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="150" align="center" valign="top"
class="explorer" id="menubar"><br
/>
<br />
<br
/>
</td>
<td width="1"
class="ctrlbar"><button
class="ctbutton" onfocus="blur();"
onmouseup="with(findObj('menubar').style){display=display=='none'?'':'none';this.innerText=display=='none'?'>':'<'}"
onmouseover="this.style.backgroundColor='#ffffff'"
onmouseout="this.style.backgroundColor='#eeeeee'"><</button></td>
<td class="explorer">
</td>
</tr>
</table>
效果图:


<script>// Example: obj = findObj("image1");
function findObj(theObj, theDoc)
{
}
</script>
<style type="text/css">
<!--
body {
}
.ctrlbar {
}
.explorer {
}
.ctbutton {
}
-->
</style>
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
</td>
</table>
前一篇:JS滚动代码问题
后一篇:利用JS可以抑动的块
< 前一篇JS滚动代码问题
后一篇 >利用JS可以抑动的块