現在タブが3つある画面を作成しています。
それぞれそのタブを選択した時の色の変更は出来たのですが初期表示(読み込み直後)が上手くいきません。ご教授願います。
<html> <head> <link rel="stylesheet" href="style.css" type="text/css"> <title></title> </head> <script type="text/javascript"> <!-- window.onload = function(){ document.getElementById(`B`).style.display = 'none'; document.getElementById('C').style.display = 'none'; window.parent.center_info.cols="17%,*," }; function cngTab(tab) { document.getElementById('A').style.display = 'none'; document.getElementById('B').style.display = 'none'; document.getElementById('C').style.display = 'none'; document.getElementById(tab).style.display = 'block'; } var color = 0; var index = 0; function cngColor(obj){ if(index == 1) { color.style.backgroundColor ='#C0C0C0'; } c = document.getElementById("Select"); c.style.backgroundColor = '#C0C0C0'; obj.style.backgroundColor ='#FFFFBB'; color = obj; index = 1; } var Line = 0; var noLine = 0; function cngBorder(obj, thisid){ if(Line == 1) { noLine.style.borderBottom ='solid thin'; } b = document.getElementById(thisid); b.style.borderBottom = 'solid thin'; obj.style.borderBottom ='solid 0px #000000'; noLine = obj; Line = 1; } // --> </script> <body> <div id="Select"> <p> <a href="#top"class="A"id="BorderA" style="cngColor(this);" onclick="cngTab('A');cngColor(this);cngBorder(this,id);" return false;>AAA</a> <a href="#top" class="B"id="BorderB" onclick="cngTab('B');cngColor(this);cngBorder(this,id);" return false;>BBB</a> <a href="#top" class="C"id="BorderC" onclick="cngTab('C');cngColor(this);cngBorder(this,id);" return false;CCC</a> </p> </div> ・・・内容・・・ </body> </html>
読み込み時「A」のタブを#FFFFBBにしたいです。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/01/09 07:32
退会済みユーザー
2018/01/09 07:45
2018/01/09 07:50