62,046
社区成员
发帖
与我相关
我的任务
分享
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>JavaScript点击文字滑出下拉列表- codefans.net</title>
<style type="text/css">
/* Start of css that is not needed for the script */
body{
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
margin-top:0px;
background-image:url('../../images/heading3.gif');
background-repeat:no-repeat;
padding-top:100px;
}
p{
margin-top:0px;
}
a{
color:#660000;
text-decoration:none;
}
/* End of css that is not needed for the script */
/* Don't delete anything below here */
.dhtmlgoodies_contentBox{
border:1px solid #317082;
height:0px;
visibility:hidden;
position:absolute;
background-color:#E2EBED;
overflow:hidden;
padding:2px;
width:250px;
}
.dhtmlgoodies_content{
position:relative;
font-family: Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif;
width:100%;
font-size:0.8em;
}
</style>
<script type="text/javascript">
var slideDownInitHeight = new Array();
var slidedown_direction = new Array();
var slidedownActive = false;
var contentHeight = false;
var slidedownSpeed = 3; // Higher value = faster script
var slidedownTimer = 7; // Lower value = faster script
function slidedown_showHide(boxId)
{
if(!slidedown_direction[boxId])slidedown_direction[boxId] = 1;
if(!slideDownInitHeight[boxId])slideDownInitHeight[boxId] = 0;
if(slideDownInitHeight[boxId]==0)slidedown_direction[boxId]=slidedownSpeed; else slidedown_direction[boxId] = slidedownSpeed*-1;
slidedownContentBox = document.getElementById(boxId);
var subDivs = slidedownContentBox.getElementsByTagName('DIV');
for(var no=0;no<subDivs.length;no++){
if(subDivs[no].className=='dhtmlgoodies_content')slidedownContent = subDivs[no];
}
contentHeight = slidedownContent.offsetHeight;
slidedownContentBox.style.visibility='visible';
slidedownActive = true;
slidedown_showHide_start(slidedownContentBox,slidedownContent);
}
function slidedown_showHide_start(slidedownContentBox,slidedownContent)
{
if(!slidedownActive)return;
slideDownInitHeight[slidedownContentBox.id] = slideDownInitHeight[slidedownContentBox.id]/1 + slidedown_direction[slidedownContentBox.id];
if(slideDownInitHeight[slidedownContentBox.id] <= 0){
slidedownActive = false;
slidedownContentBox.style.visibility='hidden';
slideDownInitHeight[slidedownContentBox.id] = 0;
}
if(slideDownInitHeight[slidedownContentBox.id]>contentHeight){
slidedownActive = false;
}
slidedownContentBox.style.height = slideDownInitHeight[slidedownContentBox.id] + 'px';
slidedownContent.style.top = slideDownInitHeight[slidedownContentBox.id] - contentHeight + 'px';
setTimeout('slidedown_showHide_start(document.getElementById("' + slidedownContentBox.id + '"),document.getElementById("' + slidedownContent.id + '"))',slidedownTimer);
}
function setSlideDownSpeed(newSpeed)
{
slidedownSpeed = newSpeed;
}
</script>
</head>
<body>
<div>
<div id="dhtmlgoodies_control"><a href="#" onclick="slidedown_showHide('box1');return false;">Try it</a></div>
<div class="dhtmlgoodies_contentBox" id="box1">
<div class="dhtmlgoodies_content" id="subBox1">
<!-- slide down content goes here -->
This is the content we want to show<br>
This is the content we want to show<br>
This is the content we want to show<br>
This is the content we want to show
<!-- End slide down content -->
</div>
</div>
</div>
<div>
Other content<br>
Other content<br>
Other content<br>
<div>
<div id="dhtmlgoodies_control"><a href="#" onclick="slidedown_showHide('box2');return false;">Try another box</a></div>
<div class="dhtmlgoodies_contentBox" id="box2">
<div class="dhtmlgoodies_content" id="subBox2">
<!-- slide down content goes here -->
This is the content of another box<br>
<!-- End slide down content -->
</div>
</div>
</div>
<script type="text/javascript">
setSlideDownSpeed(4);
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title></title>
<script language="javascript" src="lib/jquery.js"></script>
<script language="javascript" type="text/jscript">
function ShowHideChildMenu()
{
$(document).ready(function() {
var answer = $("#childMenuA");
if (answer.is(':visible')) {
answer.slideUp();
} else {
answer.slideDown();
}
});
}
</script>
</head>
<body>
<table width="180" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="20"> 日常办公</td>
<td height="20" id="ParentMenuA" class="Menu" onClick="ShowHideChildMenu()" ><div align="right">点我</div></td>
</tr>
<tr>
<td colspan="2" valign="top">
<div id="childMenuA" style="display:none ">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="28%" height="20" align="right"><img src="images/background/joinbottom.gif" width="19" height="20"></td>
<td width="72%" height="20" class="MenuChildFont"><a href="NewsRetireve.html" target="ifrMain" onClick="changeClass(this)">信息公告</a></td>
</tr>
<tr>
<td height="20" align="right"><img src="images/background/joinbottom.gif" width="19" height="20"></td>
<td height="20" class="MenuChildFont">我的邮件</td>
</tr>
<tr>
<td height="20" align="right"><img src="images/background/joinbottom.gif" width="19" height="20"></td>
<td height="20" class="MenuChildFont">工作任务</td>
</tr>
<tr>
<td height="20" align="right"><img src="images/background/joinbottom.gif" width="19" height="20"></td>
<td height="20" class="MenuChildFont">日程安排</td>
</tr>
<tr>
<td height="20" align="right"><img src="images/background/joinbottom.gif" width="19" height="20"></td>
<td height="20" class="MenuChildFont">考勤信息</td>
</tr>
<tr>
<td height="20" align="right"><img src="images/background/join.gif" width="19" height="20"></td>
<td height="20" class="MenuChildFont">消息管理</td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</body>
</html>