この記事の例は、参照のJSタブ効果の特定の実装コードを共有しています。特定のコンテンツは次のとおりです
複製画像:
実装コード:
<html> <head> <メタhttp-equiv = "content-type" content = "text/html; charset = gb2312"/> <title> unt titled document </title> <style type = "text/css"> body {font-size:12px;} .sec1 font-weight:bold;テキストアライグ:センター;バックグラウンドカラー:#990000;} .sec1 {color:#990000;テキストアライグ:センター; background-color:#fffff;} div {line-height:22px;} </style> <script language = "javascript"> function $(id){return document.getElementById(id); }関数xxk(num、id、ii、iii){// alert(ii); var dq; for(var i = 1; i <= num; i ++){if(i == id){dq = $(ii+i).classname = 'sec'; //現在のオプション$(iii+i).style.display = "block"; } else {dq = $(ii+i).classname = 'sec1'; $(iii+i).style.display = "none"; }}}} </script> </head> <body> <table cellpadding = "4" cellpacing = "1" bordercolor = "#ffffff" bgcolor = "#990000"> <td id = "t1" onmouseover = "xxk(5,1、 't'、 'tt') bgcolor = "#ffffff" id = "t2" onmouseover = "xxk(5,2、 't'、 'tt')"> tab2 </td> <td bgcolor = "#fffff" id = "t3" onmouseover = "xxk(5,3、 't'、 'tt') bgcolor = "#ffffff" id = "t4" onmouseover = "xxk(5,4、 't'、 'tt')">タブ4 </td> <td bgcolor = "#ffffff" id = "t5" onmouseover = "xxk(5,5、 't'、 'tt') colspan = "5" bgcolor = "#fffffff"> <div id = "tt1"> 1月にサービングしますstyle = "display:none;">タブは4月に機能しています</div> <div id = "tt5" style = "display:none;">タブは5月に機能します</div> </td> </tr> </table> <br/> id = "ts1" onclick = "xxk(4,1、 'ts'、 'tts')">タブ1 </td> <td bgcolor = "#ffffff" id = "ts2" onclick = "xxk(4,2、 'ts'、 'ts')" onclick = "xxk(4,3、 'ts'、 'ts')"> tab 3 </td> <td bgcolor = "#ffffff" id = "ts4" onclick = "xxk(4,4、 'ts'、 'ts')"> tab 4 </td> <div id = "tts1">タブは1月に動作しています</div> <div id = "tts2" style = "display:none;">タブは2月に動作します</div> <div id = "tts3" style = "display:"> tabは3月に仕事をしています</div> <div> <div> <div = "style =" div on " </tr> </table> </body> </html>上記はこの記事に関するものです。すべての人の学習に役立つことを願っています。