Gentilissimi,
ho scaricato un javascript (da voi) per creare un menù a comparsa che faccia al caso mio.
questo è il file
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="it">
<head>
<title>Menù a tendina verticale - Esempio JavaScript scaricato da HTML.it</title>
<meta http-equiv="Content-type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Language" content="it" />
<meta name="Robots" content="All" />
<meta name="Description" content="HTML.it - il sito italiano sul Web publishing" />
<meta name="Keywords" content="Menù a tendina le cui voci vengono mostrate in verticale." />
<meta name="Owner" content="HTML.it srl" />
<meta name="Author" content="HTML.it srl" />
<meta name="Copyright" content="HTML.it srl" />
<style type="text/css">
#dropmenudiv{
position:absolute;
background-color: #E3FFB0;
border:1px solid black;
border-bottom-width: 0;
font:normal 12px Verdana;
line-height:18px;
z-index:100;
}
#dropmenudiv a{
width: 100%;
display: block;
text-indent: 3px;
border-bottom: 1px solid black;
padding: 1px 0;
text-decoration: none;
font-weight: bold;
}
#dropmenudiv a:hover{ /*hover background color*/
background-color: #C7FF5E;
}
/* Sample CSS definition for the example list. Remove if desired */
.navlist li {
list-style-type: square;
width: 135px;
background-color: #FFFFB9;
}
</style>
<script type="text/javascript">
//Contents for menu 1
var menu1=new Array()
menu1[0]='Html.it'
menu1[1]='Freephp'
menu1[2]='Forum'
var disappeardelay=250 //menu disappear speed onMouseout (in miliseconds)
var horizontaloffset=2 //horizontal offset of menu from default location. (0-5 is a good value)
/////No further editting needed
var ie4=document.all
var ns6=document.getElementById&&!document.all
if (ie4||ns6)
document.write('<div id="dropmenudiv" style="visibility:hidden;width: 160px" onMouseover="clearhidemenu()" onMouseout="dynamichide(event)"></div>')
function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}
function showhide(obj, e, visible, hidden, menuwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=menuwidth
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}
function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWid th-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x-obj.offsetWidth < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWi dth
}
else{
var topedge=ie4 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeig ht-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeigh t
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move menu up?
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either? (position at top of viewable window then)
edgeoffset=dropmenuobj.y
}
}
return edgeoffset
}
function populatemenu(what){
if (ie4||ns6)
dropmenuobj.innerHTML=what.join("")
}
function dropdownmenu(obj, e, menucontents, menuwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidemenu()
dropmenuobj=document.getElementById? document.getElementById("dropmenudiv") : dropmenudiv
populatemenu(menucontents)
if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", menuwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+horizontaloffset+ "px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
}
return clickreturnvalue()
}
function clickreturnvalue(){
if (ie4||ns6) return false
else return true
}
function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}
function dynamichide(e){
if (ie4&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}
function hidemenu(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}
function delayhidemenu(){
if (ie4||ns6)
delayhide=setTimeout("hidemenu()",disappeardelay)
}
function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
</script>
</head>
<body >
<div align="center">
Link interessanti
</div>
<div align="center">
[img]logo_htmlit.gif[/img]
</div>
</body>
</html>
Vorrei utilizzarlo per questo menù che ho creato ma non riesco a capire come "infilarlo" nel codice che segue:
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>iupac</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link href="css/testonero.css" rel="stylesheet" type="text/css" />
<link href="css/testorosso.css" rel="stylesheet" type="text/css" />
<link href="css/linknero.css" rel="stylesheet" type="text/css" />
<link href="css/linkgrigio.css" rel="stylesheet" type="text/css" />
<link href="css/linkrosso.css" rel="stylesheet" type="text/css" />
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="200" height="421" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="25" background="img_home/botto_menu.gif" class="testorosso"><div align="center">
Last release: <span class="testonero">03th November '06</span></p>
</div></td></tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Organisers</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Promoting Committee</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Organisation</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
International advisory board</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Sci.Programme committee</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Programme</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Venue</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Accommodation</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Visas</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Exhibition</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Turin</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
<a href="http://www.mafservizi.it/c7_001/default.asp" target="_blank" class="linkrosso">Registration
Form</a></td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Organisation secretariat</td>
</tr>
<tr>
<td height="25" background="img_home/botto_menu.gif"><span class="testorosso">::</span>
Contacts</td>
</tr>
<tr>
<td background="img_home/fondino_giallo.gif"></td>
</tr>
<tr>
<td height="21">[img]img_home/bottom_menu.gif[/img]</td>
</tr>
</table>
</body>
</html>
Potete darmi consiglio?
Dovrei creare solamente le voci imparentate ad "Programme" ed ho provato a miscelare i due codici non vi dico con che risultati.
Grazie

Rispondi quotando