<html>
<head>
<style>
body
{
text-align:center;
}
.tab
{
width:422px;
height:208px;
margin:0 auto;
overflow:hidden;
border:1px solid #cccccc;
}
.menu,.menu li
{
margin:0;
padding:0;
height:24px;
list-style:none;
overflow:hidden;
text-align:center;
}
.menu
{
border-bottom:1px solid #cccccc;
}
.menu .default
{
width:84px;
float:left;
font-size:10pt;
line-height:1.5;
margin-left:1px;
cursor:pointer;
background:url(' http://www.webjx.com/upfiles/20070905/20070905212648_01.jpg') no-repeat;
}
.menu .active
{
width:84px;
float:left;
font-size:10pt;
line-height:1.5;
margin-left:1px;
cursor:pointer;
font-weight:bold;
color:#FFFFFF;
background:url(' http://www.webjx.com/upfiles/20070905/20070905212705_02.jpg') no-repeat;
}
.menu .showme,.menu .hidme{
width:76px;
float:left;
font-size:14pt;
line-height:1.5;
margin-left:1px;
cursor:pointer;
color:#0000FF;
text-align:right;
font-weight:bold;
}
.con
{
width:422px;
height:184px;
margin:0 auto;
}
</style>
<head>
<body>
<script>
var tb_h=new Array()
function init(ids,cons,dis,hids,tbs){
document.getElementById(ids).getElementsByTagName('li')[0].className='active';
document.getElementById(cons).innerHTML=document.getElementById(dis+"l1").innerHTML;
document.getElementById(ids).onmouseover=function(){onmousOver(ids,cons,dis,hids);}//鼠标指向激发效果
// document.getElementById(ids).onclick=function(){onmousOver(ids,cons,dis,hids);}//点击激发效果
var obj_tab=document.getElementById(tbs)
tb_h[tbs]=obj_tab.offsetHeight;
}
function onmousOver(ids,cons,dis,hids){
o = o || window.event;
var obj=o.target || o.srcElement;
if (obj.tagName=='LI'){
if (obj.className=='active'||obj.id==hids)return;
var o=document.getElementById(ids).getElementsByTagName('li');
for (var i=0;i<=o.length-2;i++){o[i].className='default'}
obj.className='active';
if (obj.className=='active'){document.getElementById(cons).innerHTML=document.getElementById(dis+obj.id).innerHTML;}
}
}
function show_con(tbs,ids,hids){
var obj_click=document.getElementById(hids);
obj_click.innerHTML=(obj_click.innerHTML=="+")?"-":"+"
obj_click.className=(obj_click.className=='showme')?'hidme':'showme'
var hid=(obj_click.className=='showme')?1:-1
var obj_tab=document.getElementById(tbs)
var obj_nav=document.getElementById(ids)
var h_m=obj_nav.offsetHeight+2
var H=tb_h[tbs]
var n=20,t=50;
var timers=new Array(n);
if (hid<0){
for(var i=0;i<n;i++){(
function(){
if(timers[i]) clearTimeout(timers[i]);
var j=i;
timers[i]=setTimeout(function(){obj_tab.style.height=H-Math.round((H-h_m)*(j+1)/n);},(i+1)*t);
}
)()};
}
if (hid>0){
for(var i=0;i<n;i++){(
function(){
if(timers[i]) clearTimeout(timers[i]);
var j=i;
timers[i]=setTimeout(function(){obj_tab.style.height=h_m+Math.round(H*(j+1)/n);},(i+1)*t);
}
)()};
}
}
</script>
<!--#1-->
<div id='tab1' class='tab'>
<ul id='nav1' class='menu'>
<li id="l1" class='default'>第一新闻</li>
<li id="l2" class='default'>第二新闻</li>
<li id="l3" class='default'>第三新闻</li>
<li id="hid1" class="showme" onClick="show_con('tab1','nav1','hid1')">-</li>
</ul>
<div class='con' id='con1'>
</div>
</div>
<div >
<div id="div1_l1">
<span>要做一个选项卡,在论坛里找了好久都没有理想的效果</span>
</div>
<div id="div1_l2">
<span>所以特来问一下高手们,请大家帮帮忙!</span>
</div>
<div id="div1_l3">
<span>找了几个来改,都是头部的菜单那里太难定位了</span>
</div>
</div>
<script>
init('nav1','con1',"div1_","hid1",'tab1');
</script>
<!--#2-->
<div id='tab2' class='tab'>
<ul id='nav2' class='menu'>
<li id="l1" class='default'>第一新闻</li>
<li id="l2" class='default'>第二新闻</li>
<li id="l3" class='default'>第三新闻</li>
<li id="l4" class='default'>第四新闻</li>
<li id="hid2" class="showme" onClick="show_con('tab2','nav2','hid2')">-</li>
</ul>
<div class='con' id='con2'>
</div>
</div>
<div >
<div id="div2_l1">
<span>要做一个选项卡,在论坛里找了好久都没有理想的效果</span>
</div>
<div id="div2_l2">
<span>所以特来问一下高手们,请大家帮帮忙!</span>
</div>
<div id="div2_l3">
<span>找了几个来改,都是头部的菜单那里太难定位了</span>
</div>
<div id="div2_l4">
<span>当鼠标放上去时就变,而不用点了!</span>
</div>
</div>
<script>
init('nav2','con2',"div2_","hid2",'tab2');
</script>
<!--#3-->
<div id='tab3' class='tab'>
<ul id='nav3' class='menu'>
<li id="l1" class='default'>第一新闻</li>
<li id="l2" class='default'>第二新闻</li>
<li id="l3" class='default'>第三新闻</li>
<li id="l4" class='default'>第四新闻</li>
<li id="hid3" class="showme" onClick="show_con('tab3','nav3','hid3')">-</li>
</ul>
<div class='con' id='con3'>
</div>
</div>
<div >
<div id="div3_l1">
<span>要做一个选项卡,在论坛里找了好久都没有理想的效果</span>
</div>
<div id="div3_l2">
<span>所以特来问一下高手们,请大家帮帮忙!</span>
</div>
<div id="div3_l3">
<span>找了几个来改,都是头部的菜单那里太难定位了</span>
</div>
<div id="div3_l4">
<span>当鼠标放上去时就变,而不用点了!</span>
</div>
</div>
<script>
init('nav3','con3',"div3_","hid3",'tab3');
</script>
</body>
</html>
我想让这几个选项卡的背景区别开,可不知道怎么改