将javascript的代码copy在下面(没有比代码更能说明事情的了,呵呵)
<script type="text/javascript">
<!--
/*第一种形式 第二种形式 更换显示样式*/
function setTab(name,cursel,n){
for(i=1;i<=n;i++){
var menu=document.getElementById(name+i);
var con=document.getElementById("con_"+name+"_"+i);
document.getElementById("Contentbox").style.height="0px";
if(i==cursel&&menu.className=="w"){
menu.className="hover";
con.style.display="block";
opendiv();
}else{
menu.className="w";
con.style.display="none";
}
}
}
function opendiv(){
var height=document.getElementById("Contentbox").offsetHeight;
if(height<400){
document.getElementById("Contentbox").style.height=(height+5)+"px";
setTimeout("opendiv()",10);
}
}
//-->
</script>
</head>
note:注意到没有,我们在这段代码中有</head>,而在(整理一)中有<head>,原来他们都是写在head标记中,实际上,javascript不是非要写在head标记不可,只是我们已经习惯这样做了。。
做完了这些工作,下一步我们就可以在body标记中写我们选项卡的内容了。。