•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 426,804 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 1,873 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 4676 | Replies: 3
![]() |
•
•
Join Date: Jul 2007
Location: france
Posts: 2
Reputation:
Rep Power: 0
Solved Threads: 0
I have a menu that uses javascript ot show and hide submenus. It works in IE but not in Firefox. I've pasted part of the code below: montre = show and cache = hide (french) i.e. used to show and hide the submenus. I attached the whole file if you need it.
<html>
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="menu.css" media="screen" title="Default">
<script language="JavaScript">
<!-- debut du script
function VersionNavigateur(Netscape, Explorer) {
if ((navigator.appVersion.substring(0,3) >= Netscape && navigator.appName == 'Netscape') ||
(navigator.appVersion.substring(0,3) >= Explorer && navigator.appName.substring(0,9) == 'Microsoft'))
return true;
else return false;
}
// fin du script -->
function montre(id)
{ if (document.getElementById) { document.getElementById(id).style.display="block";
} else if (document.all) {document.all[id].style.display="block";
} else if (document.layers)
{document.layers[id].display="block";
} }
function cache(id) {
if (document.getElementById) {
document.getElementById(id).style.display="none";
}
else if (document.all) {
document.all[id].style.display="none";
}
else if (document.layers) {
document.layers[id].display="none";
}
}
</script>
</head>
<body bottommargin="0" leftmargin="0" marginheight="0" marginwidth="0" rightmargin="0" topmargin="0">
<div style="position: absolute; z-index: 2; top: 0px; left: 0px; width: 100%">
<table cellspacing=0 cellpadding=0 width=210 border=0>
<tr>
<td valign=top align=right height=169>
<a href=""
onclick="window.open('bonnetg.html','','toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizab
le=no,copyhistory=no,width=480,height=577,left=272,top=95.5');return false;" title="Blason de Dompierre sur
Besbre">
<img src="imgs/bonnet.gif" border=0 width=140 height=169 />
</a>
</td>
</tr>
</table>
</div>
<div style="position: absolute; z-index: 1; top: 0px; left: 0px; width: 100%; height: 100%">
<table border=0 cellspacing=0 cellpadding=0 border=0 width=210 height=100%>
<tr height=190>
<td>
</td>
</tr>
<tr>
<td valign="top">
<form name="testage">
<input type="hidden" name="code" value="0">
</form>
<!-- Présentation -->
<a href="#" onclick="if (VersionNavigateur(3.0,4.0))
img13.src='imgs/fl_b.gif';montre('smenu4');
img14.src='imgs/fl_d.gif';cache('smenu5');
img15.src='imgs/fl_d.gif';cache('smenu6');
img16.src='imgs/fl_d.gif';cache('smenu7');
img12.src='imgs/fl_d.gif';cache('smenu3');
img11.src='imgs/fl_d.gif';cache('smenu2');
img10.src='imgs/fl_d.gif';cache('smenu1');
img20.src='imgs/fl_d.gif';cache('smenu31');">
<ul>
<li class="menu">
<table border=0 cellspacing=0>
<tr>
<td width=22 align=center>
<img name="img13" WIDTH=15
HEIGHT=15 border=0 src="imgs/fl_d.gif" onLoad="tempImg=new Image(0,0); tempImg.src='imgs/fl_b.gif'" />
</td>
<td class="titre">
<a href="centre.html"
target="centre" onclick="window.open('haut2.html','haut');cache('smenu31')"><b>Présentation</b>
</a>
</td>
</tr>
</table>
</li>
<ul id="smenu4">
<a href="#" onclick="if (VersionNavigateur(3.0,4.0))
img20.src='imgs/fl_b.gif';montre('smenu31');">
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td width=15>
</td>
<td valign=top width=10>
<img name="img20"
WIDTH=10 HEIGHT=10 border=0 src="imgs/fl_d.gif" onLoad="tempImg=new Image(0,0); tempImg.src='imgs/fl_b.gif'"
/>
</td>
<td class="titre">
<!-- Sousmenu 2 -->
<a href="centre.html"
target="centre" onclick="montre('smenu31');">Services municipaux
</a>
<ul id="smenu31">
<!-- Empeche l'affichage de la ligne en selection de la cellule -->
<script
language=javascript>
cache('smenu31');
</script>
<!-- Fin empechement -->
<table cellspacing=0
cellpadding=0 border=0>
<tr>
<td
class="sstitre">
<a href="presentation/p_1_1.html" target="centre" onclick="window.open('haut2.html','haut')"><b>- Conseil
municipal</b>
</a>
</td>
</tr>
<tr>
<td
class="sstitre">
<a href="presentation/p_1_3.html" target="centre" onclick="window.open('haut2.html','haut')"><b>- CCAS</b>
</a>
</td>
</tr>
<tr>
<td
class="sstitre">
<a href="presentation/p_1_4.html" target="centre" onclick="window.open('haut2.html','haut')"><b>-
Commissions</b>
</a>
</td>
</tr>
<tr>
<td
class="sstitre">
<a href="presentation/Cptrenduconseil.htm" target="centre" onclick="window.open('haut2.html','haut')"><b>-
Compte-rendu du Conseil Municipal</b>
</a>
</td>
</tr>
<tr>
<td
class="sstitre">
<a href="presentation/p_1_2.html" target="centre" onclick="window.open('haut2.html','haut')"><b>- Documents
administratifs</b><br /><br />
</a>
</td>
</tr>
</table>
</ul>
<!-- Fin sous menu 2 -->
</td>
</tr>
<tr>
<a href="#" onclick="if
(VersionNavigateur(3.0,4.0))
img20.src='imgs/fl_d.gif';cache('smenu31');">
<td width=15>
</td>
<td valign=top width=10
class="titre">-
</td>
<td class="titre">
<a
href="presentation/Epertiqui.htm" target="centre" onclick="cache('smenu31');">Epertiqui
</td></a>
</tr>
<tr>
<td width=15>
</td>
<td valign=top width=10
class="titre">-
</td>
<td class="titre">
<a
href="appel/a_1.html" target="centre" onclick="cache('smenu31');">Appels d'offre
</a>
</td>
</tr>
<tr>
<td width=15>
</td>
<td valign=top width=10
class="titre">-
</td>
<td class="titre">
<a
href="presentation/domtps.html" target="centre" onclick="cache('smenu31');">Dompierre au fil du temps
</a>
</td>
</tr>
<tr>
<td width=15>
</td>
<td valign=top width=10
class="titre">-
</td>
<td class="titre">
<a
href="presentation/p_1_5.html" target="centre" onclick="cache('smenu31');">Dompierre au fil de l'eau
</a>
</td>
</tr>
<tr>
<td width=15>
</td>
<td valign=top width=10
class="titre">-
</td>
<td class="titre">
<a
href="presentation/wikipedia.html" target="centre" onclick="cache('smenu31');">Informations générales
</a>
</td>
</tr>
<tr>
<td width=15>
</td>
<td valign=top width=10
class="titre">-
</td>
<td class="titre">
<a
href="presentation/dompierre.html" target="centre" onclick="cache('smenu31');">Association des Dompierre de
France
</a>
</td>
</tr>
<!--<tr><td width=15></td><td valign=top width=10><FONT FACE="cordial,garamond,Book Antiqua" SIZE=3
COLOR=#ffffff>-</td><td><FONT FACE="cordial,garamond,Book Antiqua" SIZE=3 COLOR=#ffffff><a
href="presentation/archactu.html" target="centre" onclick="cache('smenu31');">Actualités
passées</a></li></td></tr>-->
</table>
</a>
</ul>
</ul>
</a>
<!-- Economie -->•
•
Join Date: May 2006
Location: New Jersey
Posts: 1,422
Reputation:
Rep Power: 5
Solved Threads: 34
Use Firefox's built in JavaScript console. It will tell you what the error is.
John Conde
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
Brainyminds | Merchant Account Services | I Love Code
IT'S HERE: Merchant Accounts 101 Everything you need to know about merchant accounts!
I see several problems:
- You used html comments to hide part of the JavaScript. This is deprecated, and often no longer works.
- I spotted some JS errors which IE lets slip, but FF does not.
- You have some quoted content which begins on one line and ends on another. This often causes failures.
- Your if statement near the "presentation" comment is missing its begin and end braces.
- You used html comments to hide part of the JavaScript. This is deprecated, and often no longer works.
- I spotted some JS errors which IE lets slip, but FF does not.
- You have some quoted content which begins on one line and ends on another. This often causes failures.
- Your if statement near the "presentation" comment is missing its begin and end braces.
Daylight-saving time uses more gasoline
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
age ajax asp beta bon browser browsers business developer development echo email encryption environment firefox gecko home html ibm. news internet internet explorer 7 it leak linux memory microsoft mozilla msdn networking news office open source open-source patch phishing remote working scams security site social software sql super testing trends users vista web webmail working
- database connection(select ,insert query) within javascript function (JSP)
- Javascript Function to reload DOM Element? (JavaScript / DHTML / AJAX)
- Javascript not working in Firefox (JavaScript / DHTML / AJAX)
- javascript works in IE but not working in firefox (JavaScript / DHTML / AJAX)
- DateTime - TimeZone conversion with Javascript. Partially working! (JavaScript / DHTML / AJAX)
- changing font type working in IE not in firefox (HTML and CSS)
- javascript code not working in mozillafirefox (JavaScript / DHTML / AJAX)
- my php session_destroy() function not working (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Problem in Default Value of Check Box
- Next Thread: image gallery help



Linear Mode