/    Sign up×
Community /Pin to ProfileBookmark

JavaScript Rollover DHTML/PHP/JS/MQSQL

I am having trouble with my rollover menus. I am fairly sure it is something to do with either my JavaScript or CSS file. The rollover menus do not work at all. I am not sure what the problem is. I have combed over my code and compared it to a working model that I have with static content and there is literally no difference in the script files or css or html.

This is the menu.js file

[code=php]
/* stylesheet loader */

if (navigator.appName == “Netscape”) { // NS
if (parseInt(navigator.appVersion) == 4) { linkCSS(“assets/css/menuNS4.css”); }
else if (parseInt(navigator.appVersion) > 4) { linkCSS(“assets/css/menuNS6.css”); }
} else {
if (navigator.platform == “Win32”) { linkCSS(“assets/css/menuIEWin.css”); }
}

/* custom functions for 2nd level menus */

var activeM = “”, activeBG = false;
function showM() {
var a = showM.arguments[0];

hideM();

if (showM.arguments.length == 1) {
MM_showHideLayers(‘speshead’ + a,”,’show’);
MM_swapImage(” + a,”,linkRef + ‘assets/menubar/over/’ + a + ‘-a.gif’,1);
MM_showHideLayers(‘spesheadMX1′,”,’show’,’spesheadMX2′,”,’show’);
activeM = a;
if (activeBG == false) { MM_swapImage(‘spesheadMbg’,”,linkRef + ‘assets/std/grey.gif’,1); activeBG = “true”; }
}
}

function hideM() {
if (activeM != “”) {
MM_showHideLayers(‘speshead’ + activeM,”,’hide’);
MM_swapImage(” + activeM,”,linkRef + ‘assets/menubar/blue/’ + activeM + ‘.gif’,1);
activeM = “”;
}
}

function hideX() {
MM_showHideLayers(‘spesheadMX1′,”,’hide’,’spesheadMX2′,”,’hide’);
MM_swapImage(‘spesheadMbg’,”,linkRef + ‘assets/std/spacer.gif’,1);
activeBG = false;
}

function preloadM() {
var a = linkRef + ‘assets/menubar/over/’;
MM_preloadImages(a + ‘M1-a.gif’, a + ‘M2-a.gif’, a + ‘M3-a.gif’, a + ‘M4-a.gif’, a + ‘M5-a.gif’, a + ‘M6-a.gif’, a + ‘M7-a.gif’, a + ‘M8-a.gif’);
}

[/code]

This is the default.js file

[code=php]
/* Stylesheet loader */

if (navigator.appName == “Netscape”) { // NS 6
if (parseInt(navigator.appVersion) > 4) { linkCSS(“http://localhost/spes/SPES_NEW/assets/css/menu.css”); }
}

function linkCSS(a) {
document.write(“<link rel=’stylesheet’ href='” + linkRef + a + “‘ type=’text/css’ media=’screen’ />”);
}

/* Dreamweaver standard functions */

function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName==”Netscape”)&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf(“#”)!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.0
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=MM_findObj(n,d.layers[i].document);
if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
var i,p,v,obj,args=MM_showHideLayers.arguments;
for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
if (obj.style) { obj=obj.style; v=(v==’show’)?’visible’:(v=’hide’)?’hidden’:v; }
obj.visibility=v; }
}
[/PHP

——-CSS FILES—–
menu.css file
[code=php]
#spesheadMX1 { position: absolute; left: 0px; top: 0px; width: 100%; height: 25px; z-index: 10; visibility: hidden; display: block; }
#spesheadMX2 { position: absolute; left: 0px; top: 80px; width: 100%; height: 400px; z-index: 10; visibility: hidden; display: block; }

.spesheadM { position: absolute; left: 0px; top: 50px; height: 25px; width: 100%; visibility: hidden; z-index: 3; display: block; }
.spesheadMM { color: #fc0; }
.spesheadMM a { font-size: 12px; font-family: Arial, Helvetica, sans-serif; line-height: 16px; color: #fff; }
.spesheadMM a:link, .spesheadMM a:visited { color: #fff; }
.spesheadMM a:hover, .spesheadMM a:active { color: #fc0; }
.spesheadF { margin-top: 0px; margin-bottom: 0px; }
.spesheadF1 { color: #4b4b4b; font-size: 12px; background-color: #e5e5e5; vertical-align: top; padding: 4px; width: 145px; height: 13px; }
.spesheadF2 { vertical-align: top; border: 0px; margin: 0px; width: 23px; height: 20px; }
.spesheadMM a.selected, a.selected:link, a.selected:visited { color: #fc0; }
[/code]

Default.css

[code=php]
body { margin:0px }
body, p, td, th, ul, ol, h3, h4, div, li, dt, dd { font-family:Arial, Helvetica, sans-serif; font-size:12px}
a:link, a:hover, a:visited, a:active { text-decoration:none; color:#000000 }
a:hover, a:active { color:#336699 }
/*a:visited { color:#000000 }*/

.headFF { font-family:Arial, Helvetica, sans-serif; font-size:12px; color:#4B4B4B; background-color:#E5E5E5; height:22px; width:145px; padding-left:4px; padding-right:4px;}
.headFB { font-size:11px; clip:rect(0px 23px 23px 0px) }

.text10b { font-size:10px; line-height:12px; color:#222 }
.text10g { font-size:10px; line-height:12px; color:#777 }
.text10w { font-size:10px; line-height:12px; color:#FFF }
.text10r { font-size:10px; line-height:12px; color:#900 }

.text11b { font-size:11px; line-height:12px; color:#222 }
.text11g { font-size:11px; line-height:12px; color:#777 }
.text11w { font-size:11px; line-height:12px; color:#FFF }
.text11r { font-size:11px; line-height:12px; color:#900 }

.text11bw { font-size:11px; line-height:16px; color:#222 }
.text11gw { font-size:11px; line-height:16px; color:#777 }
.text11ww { font-size:11px; line-height:16px; color:#FFF }
.text11rw { font-size:11px; line-height:16px; color:#900 }

.text12b { font-size:12px; line-height:12px; color:#222 }
.text12g { font-size:12px; line-height:12px; color:#777 }
.text12w { font-size:12px; line-height:12px; color:#FFF }
.text12r { font-size:12px; line-height:12px; color:#900 }
.text12bw { font-size:12px; line-height:18px; color:#222 }

.text12b a:link, .text12bw a:link, .text11b a:link, .text11bw a:link, .text12b a:visited, .text12bw a:visited, .text11b a:visited, .text11bw a:visited { color:#900 }
.text12g a:link, .text11g a:link, .text11gw a:link, .text12g a:visited, .text11g a:visited, .text11gw a:visited { color:#900 }
.text12w a:link, .text11w a:link, .text11ww a:link, .text12w a:visited, .text11w a:visited, .text11ww a:visited { color:#FC0 }

.text12b a:hover, .text12bw a:hover, .text11b a:hover, .text11bw a:hover { color:#333 }
.text12g a:hover, .text11g a:hover, .text11gw a:hover { color:#777 }
.text12w a:hover, .text11w a:hover, .text11ww a:hover { color:#FFF }

.textM { font-size:12px; text-indent:10px; color:#FC0 }
.textM a:link, .textM a:visited { text-decoration:none; color:#FFF }
.textM a:hover, .textM a:active { text-decoration:none; color:#FC0 }

.textP { font-size:10px; color:#222 }
.textP a:link, .textP a:visited { text-decoration:none; color:#222 }
.textP a:hover, .textP a:active { text-decoration:none; color:#900 }

/* Side Bar */
.sidebar {}

/* Main Content */
h2 { margin:0; margin-top:5px; margin-bottom:5px; color:#222; font-size:18px; line-height: 10px; }
h3 { margin:0; margin-top:25px; margin-bottom:5px; color:#222; font-size:12px; }
h4 { margin:0; margin-bottom:0px; color:#4b4b4b; font-size:12px; }

/* .text12bw h2 { margin:0; margin-top:5px; margin-bottom:10px; color:#222; font-size:18px; line-height: 10px; } */

td > h3:first-child { margin-top:0; }

.text12bw p { margin-top:0; margin-bottom:10px; }
ul { margin-top:0; margin-left:0; padding-left:20px; list-style-type:none; }
ol { margin-top:0; }
li { margin-bottom:10px; }

.sl ul { margin-top:0; margin-left:0; padding-left:5px; list-style-type:none; }
.sl li { margin-bottom:5px; }

/* .text12bw li a { font-weight:bold; } */

.bold { font-weight:bold; }

dl { margin-top:0; }
dt { font-weight:bold; }
dd { margin-left: 10px; }

.level4 { color:#222; font-size:11px; font-weight:bold; }
.level4 a:link, .level4 a:visited { text-decoration:none; color:#900 }
.level4 a:hover, .level4 a:active { text-decoration:none; color:#333 }
.level4 dl { margin-top:0; margin-bottom: 0 }
.level4 dt { font-size:11px; font-weight:bold; }
.level4 dd { font-size:10px; }

.bullet { list-style-type:disc; }
.bullet li { margin-bottom:10px; }
.indent { margin-left:5px; }

select { color: #4b4b4b; font-size: 12px; background-color: #e4e4e4; padding:1px }
option { padding:1px; }
[/code]

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@ptysellauthorDec 03.2003 — ------HTML CODE-----

Header
[code=php]
<link rel="stylesheet" href="http://localhost/spes/SPES_NEW/assets/css/default.css" type="text/css">
<script language="JavaScript" type="text/javascript" src="http://localhost/spes/SPES_NEW/assets/js/default.js" media="screen" />
</script>

<link rel="stylesheet" href="http://localhost/spes/SPES_NEW/assets/css/menu.css" type="text/css">
<script language="JavaScript" type="text/javascript" src="http://localhost/spes/SPES_NEW/assets/js/menu.js" media="screem" />
</script>


<script language="JavaScript" type="text/javascript">
var linkRef = "http://localhost/spes/SPES_NEW/";
</script>
<script language="JavaScript" type="text/javascript">
function initPage()
{
preloadM();
MM_preloadImages("http://localhost/spes/SPES_NEW/assets/page-dir/index/news-a.gif", "http://localhost/spes/SPES_NEW/assets/page-dir/index/calendar-a.gif", "http://localhost/spes/SPES_NEW/assets/page-dir/index/community-a.gif");
}
</script>
[/code]



menu HTML

IN A PHP ECHO STATEMENT

I know for a fact that the variables are printing correctly

For the Main Menu
[code=php]
<td>
<a onmouseover='showM('$section_data[id]')' href='#'>
<img src='http://localhost/spes/SPES_NEW/assets/menubar/blue/$section_data[id].gif' alt='$section_data[section]' name='$menu_data[id]' id='$section_data[id]' height='25' width='100' border='0' />
</a>
</td>
[/PHP/
For the Sub Menus
Also in a PHP echo statment
[code=php]
<a href='#'>
<img src='http://localhost/spes/SPES_NEW/assets/std/bullet.gif' width='10' height='10'>
&nbsp; $subsection_data[subsection]
</a>
[/code]
×

Success!

Help @ptysell spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.8,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...