<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml" lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Style-Type" content="text/css" charset="shift_jis" />
<meta http-equiv="Content-Script-Type" content="text/javascript" charset="shift_jis" />
<title>divエリア表示切り替え</title>
<link type="text/css" href="./reset.css" rel="stylesheet" media="all" id="mycss"/>
<script src="iccr-ml.js" type="text/javascript"></script>
<script language="JavaScript">
</script>
<noscript>
JavaScript対応ブラウザで表示してください。
</noscript>
</head>
<body>
<div class="tabbox">
<ul class="tabs">
<li class="tab" id="tabA"><a href="#tab1" onclick="FocusTab('tabA','#FF5599'); ChangeTab('tab1'); return false;">タブ1</a></li>
<li class="tab" id="tabB"><a href="#tab2" onclick="FocusTab('tabB','#FFFF99'); ChangeTab('tab2'); return false;">タブ2</a></li>
<li class="tab" id="tabC"><a href="#tab3" onclick="FocusTab('tabC','#FFFF99'); ChangeTab('tab3'); return false;">タブ3</a></li>
</ul>
<div id="tab1">
<p class="tabhead">タブ1</p>
<p>タブ1タブに対応するボックス(中身)</p>
</div>
<div id="tab2">
<p class="tabhead">タブ2</p>
<p>タブ2タブに対応するボックス(中身)</p>
</div>
<div id="tab3">
<p class="tabhead">タブ3</p>
<p>タブ3に対応するボックス(中身)</p>
</div>
</div>
<script type="text/javascript">
FocusTab('tabA','#FFFF99');
ChangeTab('tab1');
</script>
</body>
</html>
----------------------------
<style type="text/css">
div.tabbox {
margin: 100px;
padding: 0px;
width: 400px;
}
div.tabbox ul.tabs {
margin: 0px;
padding: 0px;
}
div.tabbox ul.tabs li {
margin: 0px;
padding: 0px;
list-style-type: none;
width: 120px;
}
div.tabbox ul.tabs a {
display: block;
padding: 5px 0px;
height: 20px;
text-align: center;
text-decoration: none;
}
div.tabbox ul.tabs a:link,
div.tabbox ul.tabs a:visited {
color: #000;
}
div.tabbox ul.tabs a:hover {
color: #333999;
text-decoration: underline;
}
div.tabbox div.tab {
height: 150px;
overflow: auto;
}
div.tabbox div.tab p { margin: 0.5em; }
div.tabbox div.tab p.tabhead {
font-weight: bold; border-bottom: 3px double gray;
}
#tabA{
color:#3339ff;
}
-----------------------------------
function FocusTab(tabname,tabcolor) {
// タブの色
// 全部白
}
}
*/
document.getElementById('tabA').style.backgroundColor = 'White';
document.getElementById('tabB').style.backgroundColor = 'White';
document.getElementById('tabC').style.backgroundColor = 'White';
// 指定箇所のみ色を変更
if(tabname) {
document.getElementById(tabname).style.backgroundColor = tabcolor;
//document.getElementById(tabname).style.color = tabcolor;
//document.getElementById(tabname).style.Color = 'White';
}
}
// タブボックスの中身
function ChangeTab(tabname) {
// 全部消す
document.getElementById('tab1').style.display = 'none';
document.getElementById('tab2').style.display = 'none';
document.getElementById('tab3').style.display = 'none';
// 指定箇所のみ表示
if(tabname) {
document.getElementById(tabname).style.display = 'block';
}
}