Template:Tokyotechmenudark

From 2013.igem.org

(Difference between revisions)
Line 469: Line 469:
color: #000000;
color: #000000;
}
}
-
</style><!-- Core QuickMenu Code -->
+
</style>
-
<script type="text/javascript">
+
-
<!--
+
-
var timeout = 500; //unit: ms
+
-
var temp_timer = 0;  //for temp.
+
-
var showed_item = 0;  //for temp.
+
-
 
+
-
function OpenMenu(elem)
+
-
{
+
-
StopMenuTimer();
+
-
if(showed_item) showed_item.style.display = 'none';
+
-
+
-
showed_item = elem.getElementsByTagName('ul').item(0);
+
-
if(showed_item == null) return;
+
-
showed_item.style.display = 'block';
+
-
+
-
}
+
-
+
-
function CloseMenu()
+
-
{
+
-
if(showed_item) showed_item.style.display = 'none';
+
-
}
+
-
+
-
function SetCloseTimer()
+
-
{
+
-
StopMenuTimer();
+
-
temp_timer = window.setTimeout(CloseMenu, timeout);
+
-
}
+
-
+
-
function StopMenuTimer()
+
-
{
+
-
if(temp_timer)
+
-
{
+
-
window.clearTimeout(temp_timer);
+
-
temp_timer = null;
+
-
}
+
-
}
+
-
+
-
function getElementsByClass() {
+
-
    var classElements = new Array();
+
-
    var allElements = document.getElementsByTagName("*");
+
-
    for (i = 0 ; i < allElements.length; i++) {
+
-
if (allElements[i].className == 'firstHeading') {
+
-
    allElements[i].style.display = 'none';
+
-
  // window.alert('発見。');
+
-
}
+
-
    }
+
-
}
+
-
+
-
window.onload = function() {
+
-
getElementsByClass();
+
-
var menu = window.document.getElementById('qm0');
+
-
if(menu==null)
+
-
return;
+
-
var list = menu.getElementsByTagName('li');
+
-
for(i=0; i<list.length; i++)
+
-
{
+
-
list[i].onmouseover = function(){
+
-
OpenMenu(this);
+
-
}
+
-
+
-
list[i].onmouseout = function(){SetCloseTimer();}
+
-
list[i].onclick    = function(){
+
-
if(showed_item) CloseMenu();
+
-
else OpenMenu(this);
+
-
}
+
-
+
-
var n_list = list[i].getElementsByTagName('ul');
+
-
for(j=0; j<n_list.length; j++)
+
-
{
+
-
n_list[j].onmouseout = function(){SetCloseTimer();}
+
-
n_list[j].onmouseover= function(){StopMenuTimer();}
+
-
}
+
-
}
+
-
}
+
-
//-->
+
-
</script>
+
</head>
</head>

Revision as of 13:42, 26 October 2013