JS控制DIV缩放问题

<html><head><scriptlanguage=javascript>functionmenuShow(obj,maxh,obj2){if(obj.style.p... <html>
<head>

<script language=javascript>
function menuShow(obj,maxh,obj2)
{
if(obj.style.pixelHeight<maxh)
{
obj.style.pixelHeight+=maxh/20;
obj.filters.alpha.opacity+=5;
obj2.style.backgroundImage = "url(images/2.jpg)";
if(obj.style.pixelHeight==maxh/10)
obj.style.display='block';
myObj=obj;
myMaxh=maxh;
myObj2=obj2;
setTimeout('menuShow(myObj,myMaxh,myObj2)','5');
}
}
function menuHide(obj,maxh,obj2)
{
if(obj.style.pixelHeight>0)
{
if(obj.style.pixelHeight==maxh/20)
obj.style.display='none';
obj.style.pixelHeight-=maxh/20;
obj.filters.alpha.opacity-=5;
obj2.style.backgroundImage = "url(images/1.jpg)";
myObj=obj;
myMaxh=maxh
myObj2=obj2;
setTimeout('menuHide(myObj,myMaxh,myObj2)','5');
}
else
if(whichContinue)
whichContinue.click();
}
function menuChange(obj,maxh,obj2)
{
if(obj.style.pixelHeight)
{
menuHide(obj,maxh,obj2);
whichOpen='';
whichcontinue='';
}
else
if(whichOpen)
{
whichContinue=obj2;
whichOpen.click();
}
else
{
menuShow(obj,maxh,obj2);
//whichOpen=obj2;
//whichContinue='';
}
}

</script>

</head>

<div>
<div style="background-Image:url(images/2.jpg);cursor:hand;" id=div1 onclick="menuChange(menu1,200,div1);">
<span>系统选项</span>
</div>
<div style="width:800px;height:200px;filter:alpha(Opacity=100);overflow:hidden;" id=menu1>
<p>内容</p>
<p>内容</p>
<p>内容</p>
<p>内容</p>
</div>
</div>

<div>
<div style="background-Image:url(images/2.jpg);cursor:hand;" id=div2 onclick="menuChange(menu2,200,div2);">
<span>系统选项</span>
</div>
<div style="width:800px;height:200px;filter:alpha(Opacity=100);overflow:hidden;" id=menu2>
<p>内容</p>
<p>内容</p>
<p>内容</p>
<p>内容</p>
</div>
</div>

</body>
</html>

上面运行后老是默认打开状态,我想让他打开网页时是收起来的。
请高手指点。。。万分感谢!!!
展开
 我来答
百度网友035ac20
2009-10-24 · 超过24用户采纳过TA的回答
知道答主
回答量:102
采纳率:0%
帮助的人:0
展开全部
<script language="JavaScript">
function expandit(objname,objPic){
if(objname.style.display == "none"){
objPic.src = "<%=request.getContextPath() %>/images/-.gif";
objname.style.display = "";
}
else{
objPic.src = "<%=request.getContextPath() %>/images/+.gif";
objname.style.display = "none";
}

}
</script>

<table width="128" border="0" cellpadding="0" cellspacing="0"
bgcolor="#FFFFFF">
<tr>
<td width="135" height="25" align="left" style="cursor: hand"
onclick="expandit(treeitem1,treepic1);">
<img src="<%=request.getContextPath() %>/images/+.gif" id="treepic1" width="11" height="11"
hspace="5" border="0" />   <font color="blue">客户信息</font>
</td>
</tr>
<tr>
<td>
<table border="0" cellpadding="0" cellspacing="0"
bgcolor="#FFFFFF" width="100%" id="treeitem1"
style="display: none">
<tr align="right">
<td height="25">
<img src="" width="4" height="8" hspace="5" />
<a href="/FCKDemo/addNews.jsp?isOpen=true" target="contentpage">新闻添加</a>
</td>
</tr>
<tr align="right">
<td height="25">
<img src="" width="4" height="8" hspace="5" />
<a href="news/newslist.jsp" target="contentpage">新闻管理</a>
</td>
</tr>
</table>
</td>
</tr>
</table>

试试这种 感觉能比你的简单些吧
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式