menu simple
<pre><script language="javascript">
function chane(obj)
{
var sid=document.getElementById(obj);
if(sid.style.display=='block')
{
sid.style.display='none';
}
else
{
sid.style.display='block';
}
}
</script>
<div id="menu1" onclick="chane('sub1')">mainmenu</div>
<span id="sub1" style="display:none">
- <a href="#"> link 4</a><br />
- <a href="#">link 3</a><br />
- <a href="#">link 2</a><br />
- <a href="#">link 1</a>
</span>
<div id="menu2" onclick="chane('sub2')">mainmenu</div>
<span id="sub2" style="display:none">
- <a href="#"> link 4</a><br />
- <a href="#">link 3</a><br />
- <a href="#">link 2</a><br />
- <a href="#">link 1</a>
</span>
</pre>
function chane(obj)
{
var sid=document.getElementById(obj);
if(sid.style.display=='block')
{
sid.style.display='none';
}
else
{
sid.style.display='block';
}
}
</script>
<div id="menu1" onclick="chane('sub1')">mainmenu</div>
<span id="sub1" style="display:none">
- <a href="#"> link 4</a><br />
- <a href="#">link 3</a><br />
- <a href="#">link 2</a><br />
- <a href="#">link 1</a>
</span>
<div id="menu2" onclick="chane('sub2')">mainmenu</div>
<span id="sub2" style="display:none">
- <a href="#"> link 4</a><br />
- <a href="#">link 3</a><br />
- <a href="#">link 2</a><br />
- <a href="#">link 1</a>
</span>
</pre>
Không có nhận xét nào:
Đăng nhận xét