|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
OnMouseOver - Javascript
On my site for work I am working on a couple different navigation schemes to go over with the boss to make sure it meets his approval before finishing production. On one layout I want to have a pop out navigation system using javascript. Which I can accomplish just fine and I have completed it. But at the same time I want the original image to have OnMouseOver action as well. But I can't seem to get it to work using one OnMouseOver action to create the rollover effect on the original button and at the same time pop out the sub-menus. Is is possible to have both or do I have to pick on or the other?
Here are the two codes: Code:
<img src="../Left/Sliced/1.png" width="125" height="44"><a href="corpinfo.php" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Corporate Information','','../Left/Sliced/2R.png',1)">
The above is for the rollover action to take place on the original graphic. Code:
<a href=javascript:; onmouseover=s_show('corpinfo',event) onmouseout=s_hide()><img src=../Left/Sliced/1.png></a>
That is the code I use if I want to have the sub-menu pop out. I've tried combining the two but it doesn't work so I thought there might be a secret to it that I'm missing. Any help would be appreciated. Thanks! The Squirrel |
|
#2
|
||||
|
||||
|
RE: OnMouseOver - Javascript
Just put both javascript calls into the onMouseOver attribute:
Code:
onMouseOver="MM_swapImage('Corporate Information','','../Left/Sliced/2R.png',1); s_show('corpinfo',event);"
|
|
#3
|
|||
|
|||
|
RE: OnMouseOver - Javascript
Thanks that did the trick. I don't know why I didn't think about adding both calls into one onMouseOven event. Just shows my noobieness with Javascript.
Thanks again! The Squirrel |
|
#4
|
|||
|
|||
|
RE: OnMouseOver - Javascript
Just found a small problem that is partially related to this. On one of the pages I have a flash 'ducument' if you will, and when I roll over the navigation menu to go to another portion of the site the submenus are under this flash file. I have it in a layer and I made the layer to be on the most bottom level as possible but I am still getting same results. Are there any ways around this?
Found another one... Edit: In IE I found that the error is being caused by line 18 of the code. Here is line 18: } Yup, that's it. But that belongs to this code: function MM_swapImgRestore() { var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc; } <--Line 18 Here is the complete error message: Line: 18 Char: 3569 Error: 's_[...].0' is null or not an object Code: 0 URL: URL to my page I'm continuing to look into it but any help or suggestions from you guys would be appreciated. Thanks! The Squirrel |
|
#5
|
||||
|
||||
|
RE: OnMouseOver - Javascript
Line 18, Character 3569 looks a little strange since that line isn't near that long. My guess is that the file doesn't have correct wnd-of-line characters and the error is further down the code.
|
|
#6
|
|||
|
|||
|
RE: RE: OnMouseOver - Javascript
Hmmm that is strange.
Here is the whole javascript that is on the page that is causing problems if it will help any: Code:
<script language=JavaScript>
<!--
function s_show(){return false}
function s_hide(){return false}
if(window.event+''=='undefined')event=0
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_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_findObj(n, d) { //v4.01
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 && d.getElementById) x=d.getElementById(n); return x;
}
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];}
}
//-->
</script>
This is most puzzling. |
|
#7
|
|||
|
|||
|
RE: OnMouseOver - Javascript
Ok, I got it figured out now. It was a syntax error that should've been fine but IE was extramly picky with it.
At the end of each menu is code such as: {U:'CoatingBooth-3.php',T:'Coating Booths - p.3'}, {U:'ECSwPrimerBooth.php',T:'Extrusion Coating...'}, {U:'tolulene.php',T:'Tolulene Applicator'} ] ); At the end of each line you're supposed to seperate it was a comma, well I did that on all lines, including the final line before the closing ] bracket. Removed that single comma and all works well. Reason I didn't discover this sooner is because one of the other menus had a comma on the last line and it worked fine. But thanks for the help anyways. The Squirrel |
|
#8
|
|||
|
|||
|
RE: OnMouseOver - Javascript
to answer your popup menu under flash question,
i had the same problem a while back - to get around it you can add the following: Code:
<param name="wmode" value="transparent"> with the other lines that "look the same" (can you tell i'm a proffesional? ;) it was a while ago but i think that's it. you might get some problems with your flash file - not entirely sure what it actually does, but for the majority of files i've used it with it has worked fine. |
|
#9
|
|||
|
|||
|
RE: RE: OnMouseOver - Javascript
Quote:
Thanks, but where would I add that code to? I will probably figure it out but thought I'd ask anyways. The Squirrel |
|
#10
|
|||
|
|||
|
RE: OnMouseOver - Javascript
sorry - i meant with the other "param name=" bits in your html.
hope it works! Code:
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="512" height="116">
<param name="wmode" value="transparent">
<param name=movie value="../flash/crowd.swf">
<param name=quality value=high>
<embed src="../flash/crowd.swf" quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="512" height="116">
</embed>
</object>
edit: why is there a nasty grinning smilie in my code? i thought it was supposed to avoid that sort of thing.. |
|
#11
|
|||
|
|||
|
RE: OnMouseOver - Javascript
Sorry about my slowness. I don't know why I didn't realize that the param name code went into the flash part of the site. It was still early in (to me) when I wrote that post and I didn't read your post very well.
But anyways, that didn't seem to work. I put in the code and it is still showing up under the flash. I looked at the source code from the internet and that code is not there. I know I copied the file to my directory since I opened it directly from the web site directory in order to make sure the code was still there. The Squirrel |
|
#12
|
|||
|
|||
|
RE: OnMouseOver - Javascript
hmm
not sure what your problem is - i made a (very!) quick test here: http://www.sojomedia.com/codewalker/ both with and without the Code:
<param name="wmode" value="transparent"> seems to work fine.. good luck! |
|
#13
|
|||
|
|||
|
RE: OnMouseOver - Javascript
Ok, that helped me figure out the problem. It was my browser... It works fine in IE, but does not work in Mozilla Firebird.
Thanks for your help. The Squirrel |
|
#14
|
|||
|
|||
|
RE: OnMouseOver - Javascript
ah, that's interesting..
presumably there's a better method that will work with all browsers.. hopefully.. |
|
#15
|
|||
|
|||
|
RE: OnMouseOver - Javascript
I would certainly hope/think so. I will post here if I find anything out about it.
The Squirrel |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Client Side Things > OnMouseOver - Javascript |
| Thread Tools | Search this Thread |