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>
上面运行后老是默认打开状态,我想让他打开网页时是收起来的。
请高手指点。。。万分感谢!!! 展开
<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>
上面运行后老是默认打开状态,我想让他打开网页时是收起来的。
请高手指点。。。万分感谢!!! 展开
展开全部
<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>
试试这种 感觉能比你的简单些吧
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>
试试这种 感觉能比你的简单些吧
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询