JS(JavaScript)に使用できるタブタグの切り替えコードは、幅に自動的に適応でき、タグブロックを自分で完成させることができます。
コードコピーは次のとおりです。
<!doctype html public " - // w3c // dtd html 4.01 transitional // en" "http://www.w3c.org/tr/1999/rec-html401-
19991224/loose.dtd ">
<html xmlns = "http://www.w3.org/1999/xhtml"> <head>
<Meta name = "keywords" content = "JSコード、タブタグ、JS広告コード、JS Special Effect Code、Yuewei Caotang" />
<title>適応幅のタグナビゲーション</title>
<Meta http-equiv = content-type content = "text/html; charset = gb2312">
<style type = text/css>
ボディ{font-size:14px;
ol li {マージン:8px}
#con {font-size:12px;
#tags {0px-0px:0px 0px-400px;
トップ:0px:23px}
#tags li {backgracuds/tagleft.gif)
なし;高さ:23px}
#tags li a {padding-right:10px-10px;
フロート:パディングボトム:#999:
なし}
#tags li.EmptyTag {背景:透明なスクロール繰り返し0%0%;
#tags li.selecttag {左上:-2px:25px;
#tags li.selecttag {右上部:#000:25px;
#tagcontent {padding-right:#aecbd4 solien
1px; #fff}
.tagcontent {padding-right:display:なし:10px(bg.gif);
パディングボトム:幅576px:#474747;
#tagcontent div.selecttag {display:block}
</style>
<Meta content = "mshtml 6.00.2800.1589" name = generator> </head>
<body>
<div id = con>
<ul id = tags>
<li class = selecttag> <a onmouseover = "selecttag( 'tagcontent0'、this)" href = "javascript:void(0)">タグ1 </a> </li>
<li> <onMouseOver = "selecttag( 'tagcontent1'、this)" href = "javascript:void(0)"> tag 2 </a> </li>
<li> <onMouseOver = "selecttag( 'tagcontent2'、this)" href = "javascript:void(0)">適応幅のタグ</a> </li>
<li> <A onMouseOver = "SelectTag( 'TagContent3'、this)" href = "javascript:void(0)"> adaptive width </a> </li>
</ul>
<div id = tagcontent>
<div class = tagcontent id = tagcontent0>最初のタグのコンテンツ</div>
<div id = tagcontent1> 2番目のタグのコンテンツ</div>
<div class = tagcontent id = tagcontent2> 3番目のタグのコンテンツ</div>
<div class = tagcontent id = tagcontent3> 4番目のタグのコンテンツ</div>
</div>
</div>
<script type = text/javascript>
function selecttag(showcontent、selfobj){
//操作タグ
var tag = document.getElementById( "Tags")。getElementsByTagname( "li");
var taglength = tag.length;
for(i = 0; i <taglength; i ++){
tag [i] .classname = "";
}
selfobj.parentnode.classname = "selecttag";
//操作コンテンツ
for(i = 0; j = document.getElementById( "tagContent"+i); i ++){
J.Style.display = "none";
}
document.getElementById(showcontent).style.display = "block";
}
</script>
</body> </html>