做网页.关于一个网页特效,鼠标移过去就变内容.
如泡泡网.www.pcpop.com一进去到下移一点点.有个"今日头条"和"产品论坛"就是这个效果怎么做啊?...
如泡泡网. www.pcpop.com
一进去到下移一点点. 有个"今日头条"和"产品论坛"
就是这个效果怎么做啊? 展开
一进去到下移一点点. 有个"今日头条"和"产品论坛"
就是这个效果怎么做啊? 展开
2个回答
展开全部
用javascript配合div就可以了,下面代码就可以
-----
<div style="width:300px;height:300px;border:1px solid">
<div><a href="#" onmouseenter="qa('div1')">栏目一</a>|<a href="#" onmouseenter="qa('div2')"> 栏目二</a></div>
<div id="div1">栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p></div>
<div id="div2" style="display:none">变<p>变<p>变<p>变<p>变<p>变<p>变<p>变<p>变</div>
</div>
<script language="javascript">
function qa(obj)
{
if(obj=="div1")
{
document.getElementById('div1').style.display="";
document.getElementById("div2").style.display="none";
}
else
{
document.getElementById('div1').style.display="none";
document.getElementById("div2").style.display="";
}
}
</script>
-----
<div style="width:300px;height:300px;border:1px solid">
<div><a href="#" onmouseenter="qa('div1')">栏目一</a>|<a href="#" onmouseenter="qa('div2')"> 栏目二</a></div>
<div id="div1">栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p>栏目一<p></div>
<div id="div2" style="display:none">变<p>变<p>变<p>变<p>变<p>变<p>变<p>变<p>变</div>
</div>
<script language="javascript">
function qa(obj)
{
if(obj=="div1")
{
document.getElementById('div1').style.display="";
document.getElementById("div2").style.display="none";
}
else
{
document.getElementById('div1').style.display="none";
document.getElementById("div2").style.display="";
}
}
</script>
展开全部
<html>
<body>
<style>
TD{
font-size: 9pt; color: #66DDDD}
.out{
font-size: 9pt; color: #66DDDD;border-width:1px;border-style:solid;border-color:0090c0 0070b0 0070b0 0090c0;cursor:hand; background:0080c0; text-align: center}
.out2 {
text-align: center}
.in,.out2{
font-size: 9pt; color: #66DDDD;border-width:1px;border-style:solid;border-color:0070b0 0090c0 0090c0 0070b0;background:0078b8;cursor:default}
</style>
<script>
var temp_num = null;
var now_num = null;
var the_top = 127; //表单的最高,最低
var the_bottom = 146
var no_can_do = false;
function Show_menu(u_num,d_num)
{
event.srcElement.className = "out2";
if(no_can_do)
{
return;
}
now_num = d_num;
if(temp_num)
{
if(document.getElementById("menu_"+temp_num).doing)
{
clearInterval(document.getElementById("menu_"+temp_num).doing);
}
}
else
{
temp_num = u_num;
}
document.getElementById("menu_"+temp_num).doing = setInterval("set_menu()",10);
}
function set_menu()
{
no_can_do = true;
document.getElementById("form_"+temp_num).style.display = "none";
var if_move = document.getElementById("div_"+temp_num).style.pixelHeight - 6;
if(if_move>1)
{
document.getElementById("div_"+temp_num).style.pixelHeight = if_move;
}
else
{
document.getElementById("div_"+temp_num).style.pixelHeight = 1;
var if_stop = document.getElementById("menu_"+temp_num).style.pixelTop - 1;
if(if_stop>the_top)
{
document.getElementById("menu_"+temp_num).style.pixelTop = if_stop;
document.getElementById("menu_"+now_num).style.pixelTop += 1;
}
else
{
document.getElementById("menu_"+temp_num).style.pixelTop = the_top;
document.getElementById("menu_"+now_num).style.pixelTop = the_bottom;
var if_end = document.getElementById("div_"+now_num).style.pixelHeight + 6;
if(if_end < 182)
{
document.getElementById("div_"+now_num).style.pixelHeight = if_end
}
else
{
document.getElementById("div_"+now_num).style.pixelHeight = 182;
clearInterval(document.getElementById("menu_"+temp_num).doing);
document.getElementById("menu_"+temp_num).doing = false;
document.getElementById("form_"+now_num).style.display = "block";
temp_num = null;
no_can_do = false;
}
}
}
}
function returnIT()
{
event.srcElement.className = "out";
}
</script>
<div id="menu_0" style="position: absolute; top: 127; left: 176; width: 339; height: 201">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="19">
<tr>
<td width="277" class="out" height="19" style="cursor: default"> </td>
<td width="58" class="out" height="19" onmouseover="Show_menu(1,0)" onmouseout="returnIT()">老师登录</td>
</tr>
</table>
<div id="div_0" style="position: relative; width: 339; height: 1; overflow: hidden">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="182">
<tr>
<td width="100%" height="182">
<form id="form_0" style="position: relative; left:70; top:10;font-family: Arial; display: none" action="javascript:;" method="post" align="center">
当前用户类型:老师
<br>
<br>
用户: <input class="in" style="WIDTH: 100px" size="20"> mail.cn<br>
口令: <input class="in" type="password" size="20"><br>
<br>
<input class="out" onfocus="this.blur()" type="button" value="登录服务器">
</form>
</td>
</tr>
</table>
</div>
</div>
<div id="menu_1" style="position: absolute; top: 146; left: 176; width: 339; height: 219">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="19">
<tr>
<td width="277" class="out" height="19" style="cursor: default"> </td>
<td width="58" class="out" height="19" onmouseover="Show_menu(0,1)" onmouseout="returnIT()">学生登录</td>
</tr>
</table>
<div id="div_1" style="position: relative; width: 339; height: 182; overflow: hidden">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td width="100%" height="182">
<form id="form_1" style="position: relative; left:70; top:10;font-family: Arial; display: block" action="javascript:;" method="post" align="center">
当前用户类型:学生
<br>
<br>
用户: <input class="in" style="WIDTH: 100px" size="20"> mail.cn<br>
口令: <input class="in" type="password" size="20"><br>
<br>
<input class="out" onfocus="this.blur()" type="button" value="登录服务器">
</form>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
<body>
<style>
TD{
font-size: 9pt; color: #66DDDD}
.out{
font-size: 9pt; color: #66DDDD;border-width:1px;border-style:solid;border-color:0090c0 0070b0 0070b0 0090c0;cursor:hand; background:0080c0; text-align: center}
.out2 {
text-align: center}
.in,.out2{
font-size: 9pt; color: #66DDDD;border-width:1px;border-style:solid;border-color:0070b0 0090c0 0090c0 0070b0;background:0078b8;cursor:default}
</style>
<script>
var temp_num = null;
var now_num = null;
var the_top = 127; //表单的最高,最低
var the_bottom = 146
var no_can_do = false;
function Show_menu(u_num,d_num)
{
event.srcElement.className = "out2";
if(no_can_do)
{
return;
}
now_num = d_num;
if(temp_num)
{
if(document.getElementById("menu_"+temp_num).doing)
{
clearInterval(document.getElementById("menu_"+temp_num).doing);
}
}
else
{
temp_num = u_num;
}
document.getElementById("menu_"+temp_num).doing = setInterval("set_menu()",10);
}
function set_menu()
{
no_can_do = true;
document.getElementById("form_"+temp_num).style.display = "none";
var if_move = document.getElementById("div_"+temp_num).style.pixelHeight - 6;
if(if_move>1)
{
document.getElementById("div_"+temp_num).style.pixelHeight = if_move;
}
else
{
document.getElementById("div_"+temp_num).style.pixelHeight = 1;
var if_stop = document.getElementById("menu_"+temp_num).style.pixelTop - 1;
if(if_stop>the_top)
{
document.getElementById("menu_"+temp_num).style.pixelTop = if_stop;
document.getElementById("menu_"+now_num).style.pixelTop += 1;
}
else
{
document.getElementById("menu_"+temp_num).style.pixelTop = the_top;
document.getElementById("menu_"+now_num).style.pixelTop = the_bottom;
var if_end = document.getElementById("div_"+now_num).style.pixelHeight + 6;
if(if_end < 182)
{
document.getElementById("div_"+now_num).style.pixelHeight = if_end
}
else
{
document.getElementById("div_"+now_num).style.pixelHeight = 182;
clearInterval(document.getElementById("menu_"+temp_num).doing);
document.getElementById("menu_"+temp_num).doing = false;
document.getElementById("form_"+now_num).style.display = "block";
temp_num = null;
no_can_do = false;
}
}
}
}
function returnIT()
{
event.srcElement.className = "out";
}
</script>
<div id="menu_0" style="position: absolute; top: 127; left: 176; width: 339; height: 201">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="19">
<tr>
<td width="277" class="out" height="19" style="cursor: default"> </td>
<td width="58" class="out" height="19" onmouseover="Show_menu(1,0)" onmouseout="returnIT()">老师登录</td>
</tr>
</table>
<div id="div_0" style="position: relative; width: 339; height: 1; overflow: hidden">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="182">
<tr>
<td width="100%" height="182">
<form id="form_0" style="position: relative; left:70; top:10;font-family: Arial; display: none" action="javascript:;" method="post" align="center">
当前用户类型:老师
<br>
<br>
用户: <input class="in" style="WIDTH: 100px" size="20"> mail.cn<br>
口令: <input class="in" type="password" size="20"><br>
<br>
<input class="out" onfocus="this.blur()" type="button" value="登录服务器">
</form>
</td>
</tr>
</table>
</div>
</div>
<div id="menu_1" style="position: absolute; top: 146; left: 176; width: 339; height: 219">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="19">
<tr>
<td width="277" class="out" height="19" style="cursor: default"> </td>
<td width="58" class="out" height="19" onmouseover="Show_menu(0,1)" onmouseout="returnIT()">学生登录</td>
</tr>
</table>
<div id="div_1" style="position: relative; width: 339; height: 182; overflow: hidden">
<table border="0" width="100%" style="background-color: #0080C0" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td width="100%" height="182">
<form id="form_1" style="position: relative; left:70; top:10;font-family: Arial; display: block" action="javascript:;" method="post" align="center">
当前用户类型:学生
<br>
<br>
用户: <input class="in" style="WIDTH: 100px" size="20"> mail.cn<br>
口令: <input class="in" type="password" size="20"><br>
<br>
<input class="out" onfocus="this.blur()" type="button" value="登录服务器">
</form>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询