Ændre i javamenu fra mouseover til onclick
Hej eksperterpå nedenstående har jeg en menubar i java kode.
http://www.coj.dk/nyhp/index_ekspert.htm
denne menubar vil jeg gerne have til at fungere som www.sydbank.dk altså ikke ved aktivering gennem onmouseover men på onclick.
her er site koden (tag jer ikke af at baren hopper rundt for det gider jeg ikke rette før jeg ved om det er denne menu der skal bruges) :
<tbody>
<tr>
<td height="20"> <a onmouseover="openclose('dropdown1')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 1</a> | </td>
<td height="20"> <a onmouseover="openclose('dropdown2')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 2</a> | </td>
<td height="21"> <a onmouseover="openclose('dropdown3')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 3</a> | </td>
<td height="20"> <a onmouseover="openclose('dropdown4')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 4</a> | </td>
<td height="20"> <a onmouseover="openclose('dropdown5')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 5</a> | </td>
<td height="21"> <a onmouseover="openclose('dropdown6')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 6</a> | </td>
<td height="21"> <a onmouseover="openclose('dropdown7')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 7</a> | </td>
<td height="21"> <a onmouseover="openclose('dropdown8')" onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 8</a> | </td>
<td height="21"> <a onmouseout="timerID=setTimeout('closeall()',1000)" href="index.htm" class="header">pkt 9</a> </td>
</tr>
</tbody>
</table>
</div>
<!-- Menu items end-->
<!-- Dropdowns -->
<div id="dropdown1" style="left: 278px; visibility: hidden; width: 392px; position: absolute; top: 120px; height: 23px">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/" class="subheader">u_pkt 1</a>
</td>
</tr>
</tbody>
</table>
</div>
<div id="dropdown2" style="LEFT: 312px; VISIBILITY: hidden; WIDTH: 334px; POSITION: absolute; TOP: 120px; HEIGHT: 8px">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/business_planning.html" class="subheader">u_pkt 2 | </a>
<a href="http://planmagic.com/tourbiz/" class="subheader">u_pkt 2 |</a>
<a href="http://planmagic.com/download.html" class="subheader">u_pkt 2</a></td>
</tr>
</tbody>
</table>
</div>
<div id="dropdown3" style="left: 431px; visibility: hidden; width: 304px; position: absolute; top: 120px; height: 23px">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/marketing_planning.html" class="subheader">u_pkt 3 | </a>
<a href="http://planmagic.com/tourmar/" class="subheader">u_pkt 3 |</a>
<a href="http://planmagic.com/download.html" class="subheader">u_pkt 3</a></td>
</tr>
</tbody>
</table>
</div>
<div id="dropdown4" style="left: 543px; visibility: hidden; width: 201px; position: absolute; top: 120px; height: 23px">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/financial_planning.html" class="subheader">u_pkt 4 | </a>
<a href="http://planmagic.com/download.html" class="subheader">u_pkt 4</a></td>
</tr>
</tbody>
</table>
</div>
<div id="dropdown5" style="left: 673; visibility: hidden; width: 244; position: absolute; top: 120px; height: 23">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/webquest.html" class="subheader">u_pkt 5 | </a>
<a href="http://webquestpro.com" class="subheader">u_pkt 5 | </a>
<a href="http://planmagic.com/download.html" class="subheader">u_pkt 5</a></td>
</tr>
</tbody>
</table>
</div>
<div id="dropdown6" style="left: 747; visibility: hidden; width: 167; position: absolute; top: 120px; height: 23">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/company.html" class="subheader">u_pkt 6 | </a>
<a href="http://planmagic.com/contact.html" class="subheader">u_pkt 6</a></td>
</tr>
</tbody>
</table>
</div>
<div id="dropdown7" style="left: 747; visibility: hidden; width: 167; position: absolute; top: 120px; height: 23">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/company.html" class="subheader">u_pkt 7 | </a>
<a href="http://planmagic.com/contact.html" class="subheader">u_pkt 7</a></td>
</tr>
</tbody>
</table>
</div>
<div id="dropdown8" style="left: 747; visibility: hidden; width: 167; position: absolute; top: 120px; height: 23">
<table class="popup" onmouseover="clearTimeout(timerID)" onmouseout="timerID=setTimeout('closeall()',1000)" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td>
<a href="http://planmagic.com/company.html" class="subheader">u_pkt 8 | </a>
<a href="http://planmagic.com/contact.html" class="subheader">u_pkt 8</a></td>
</tr>
</tbody>
og hvis det er nødvendigt med java scriptet er det her:
function preload() {
if (!document.images) return;
var ar = new Array();
var arguments = preload.arguments;
for (var i = 0; i < arguments.length; i++) {
ar[i] = new Image();
ar[i].src = arguments[i];
}
}
function reloadPage(init) {
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);
var timerID = null;
drop1state=0
drop2state=0
drop3state=0
drop4state=0
drop5state=0
drop6state=0
drop7state=0
drop8state=0
n = (document.layers) ? 1:0
ie = (document.all) ? 1:0
function closeall()
{
if((drop1state==1)|(drop2state==1)|(drop3state==1)|(drop4state==1) |(drop5state==1)|(drop6state==1))
{
if (ie){
dropdown1.style.visibility="hidden";
dropdown2.style.visibility="hidden";
dropdown3.style.visibility="hidden";
dropdown4.style.visibility="hidden";
dropdown5.style.visibility="hidden";
dropdown6.style.visibility="hidden";
dropdown7.style.visibility="hidden";
dropdown8.style.visibility="hidden"
}
else if (n){
document.dropdown1.visibility="hide";
document.dropdown2.visibility="hide";
document.dropdown3.visibility="hide";
document.dropdown4.visibility="hide";
document.dropdown5.visibility="hide";
document.dropdown6.visibility="hide";
document.dropdown7.visibility="hide";
document.dropdown8.visibility="hide"
}
drop1state=0; drop2state=0; drop3state=0; drop4state=0; drop5state=0; drop6state=0; drop7state=0; drop8state=0;
}
}
function openclose(drop){
if (drop=="dropdown1") { dropstate=drop1state }
if (drop=="dropdown2") { dropstate=drop2state }
if (drop=="dropdown3") { dropstate=drop3state }
if (drop=="dropdown4") { dropstate=drop4state }
if (drop=="dropdown5") { dropstate=drop5state }
if (drop=="dropdown6") { dropstate=drop6state }
if (drop=="dropdown7") { dropstate=drop7state }
if (drop=="dropdown8") { dropstate=drop8state }
if (ie){dropdown1.style.visibility="hidden";
dropdown2.style.visibility="hidden";
dropdown3.style.visibility="hidden";
dropdown4.style.visibility="hidden";
dropdown5.style.visibility="hidden";
dropdown6.style.visibility="hidden";
dropdown7.style.visibility="hidden";
dropdown8.style.visibility="hidden"
}
else if (n){
document.dropdown1.visibility="hide";
document.dropdown2.visibility="hide";
document.dropdown3.visibility="hide";
document.dropdown4.visibility="hide";
document.dropdown5.visibility="hide";
document.dropdown6.visibility="hide";
document.dropdown7.visibility="hide";
document.dropdown8.visibility="hide"
}
drop1state=0; drop2state=0; drop3state=0; drop4state=0; drop5state=0; drop6state=0; drop7state=0; drop8state=0
clearTimeout(timerID);
if (dropstate==0){
if (n){ document.layers[drop].visibility="show" }
else if (ie){ document.all[drop].style.visibility="visible" }
if (drop=="dropdown1") { drop1state=1; }
if (drop=="dropdown2") { drop2state=1; }
if (drop=="dropdown3") { drop3state=1; }
if (drop=="dropdown4") { drop4state=1; }
if (drop=="dropdown5") { drop5state=1; }
if (drop=="dropdown6") { drop6state=1; }
if (drop=="dropdown7") { drop6state=1; }
if (drop=="dropdown8") { drop6state=1; }
}
}
function swapImgRestore() {
var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
clearTimeout(timerID);
timerID = setTimeout("closeall()", 4);
}
function preloadImages() {
var d=document; if(d.images){ if(!d.p) d.p=new Array();
var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}
function findObj(n, d) {
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=findObj(n,d.layers[i].document); return x;
}
function swapImage() {
var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
jeg har prøvet at ændre mouseover til onclick , men eftersom det href'er siden til sig selv forsvinder undermenuen jo :-D
håber i har tid til lidt hjælp.