Ho una pagina formata da un menu dinamico e poi da un'altro script ke aggiorna l'ora . Non riescoa far conviere i due;o meglio, il menu dinamico viene visualizzato aperto e non si chiude e riapre. Qualcuno riesce a dirmi come si fa farli convivere? Grazie!
codice:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Fantafrosties</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="css/stylesheet-footer.css">
<script type="text/javascript">
var persistmenu="yes" //"yes" or "no". Make sure each SPAN content contains an incrementing ID starting at 1 (id="sub1", id="sub2", etc)
var persisttype="sitewide" //enter "sitewide" for menu to persist across site, "local" for this page only
if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}
function SwitchMenu(obj){
if(document.getElementById){
var el = document.getElementById(obj);
var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
if(el.style.display != "block"){ //DynamicDrive.com change
for (var i=0; i<ar.length; i++){
if (ar[i].className=="submenu") //DynamicDrive.com change
ar[i].style.display = "none";
}
el.style.display = "block";
}else{
el.style.display = "none";
}
}
}
function get_cookie(Name) {
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) {
offset += search.length
end = document.cookie.indexOf(";", offset);
if (end == -1) end = document.cookie.length;
returnvalue=unescape(document.cookie.substring(offset, end))
}
}
return returnvalue;
}
function onloadfunction(){
if (persistmenu=="yes"){
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=get_cookie(cookiename)
if (cookievalue!="")
document.getElementById(cookievalue).style.display="block"
}
}
function savemenustate(){
var inc=1, blockid=""
while (document.getElementById("sub"+inc)){
if (document.getElementById("sub"+inc).style.display=="block"){
blockid="sub"+inc
break
}
inc++
}
var cookiename=(persisttype=="sitewide")? "switchmenu" : window.location.pathname
var cookievalue=(persisttype=="sitewide")? blockid+";path=/" : blockid
document.cookie=cookiename+"="+cookievalue
}
if (window.addEventListener)
win????
?u??º?dow.addEventListener("load", onloadfunction, false)
else if (window.attachEvent)
window.attachEvent("onload", onloadfunction)
else if (document.getElementById)
window.onload=onloadfunction
if (persistmenu=="yes" && document.getElementById)
window.onunload=savemenustate
</script>
</head>
<body>
<SCRIPT LANGUAGE="javascript">
function visua()
{
var _date = new Date();
var _giorno = _date.getDate();
var _mese = _date.getMonth() + 1;
var _anno = _date.getFullYear();
var _ora = _date.getHours();
var _minuti = _date.getMinutes();
var _secondi = _date.getSeconds();
var _giorno2 = ((_giorno < 10) ? "0" : "");
var _mese2 = ((_mese < 10) ? ".0" : ".");
var _ora2 = ((_ora < 10) ? "0" : "");
var _minuti2 = ((_minuti < 10) ? ":0" : ":");
var _secondi2 = ((_secondi < 10) ? ":0" : ":");
var Data = _giorno2 + _giorno + _mese2 + _mese + "." + _anno;
var Orario = _ora2 + _ora + _minuti2 + _minuti + _secondi2 + _secondi;
if(document.all)
document.all.orario.innerHTML = Orario;
else
if(document.getElementById)
document.getElementById('orario').innerHTML = Orario;
if(document.all)
document.all.data.innerHTML = Data;
else
if(document.getElementById)
document.getElementById('data').innerHTML = Data;
window.setTimeout("visua()",1000);
}
onload=visua;
</SCRIPT>
<table>
<tr>
<th>
<table width="580">
<tr><th>Per informazioni e qualsiasi altra cosa</th></tr>
<tr><th>mail@indirizzo.com</a></th></tr>
</table>
</th>
<th>
<table align="left">
<tr><th><P ID="orario"></P></th></tr>
<tr><th><P ID="data"></P></th></tr>
<tr><th>pochi.. utenti online</th></tr>
</table>
</th>
</tr>
</table>
<table>
<tr>
<th id="title">LOGIN</th>
</tr>
<tr>
<th>
<div id="masterdiv">
<div class="menutitle" onclick="SwitchMenu('sub1')">Username</div>
<span class="submenu" id="sub1">
- What's New
- What's hot
- Revised Scripts
- More Zone
</span>
<div class="menutitle" onclick="SwitchMenu('sub2')">Password</div>
<span class="submenu" id="sub2">
- Usage Terms
- DHTML FAQs
- Scripts FAQs
</span>
<div class="menutitle" onclick="SwitchMenu('sub3')">Entra</div>
<span class="submenu" id="sub3">
- Coding Forums
</span>
<div class="menutitle" onclick="SwitchMenu('sub4')">Hai dimenticato la password?</div>
<span class="submenu" id="sub4">
- JavaScript Kit
- Freewarejava
- Cool Text
- Google.com
</span>
</div>
</th>
</tr>
</table>
</body>
</html>
a