PDA

View Full Version : Image Swaps


stevef
03-22-2001, 07:32 AM
I am hoping somebody can help a complete novice here:

I have a piece of code (which I will paste in below) that is throwing up errors on one page, but used on several.

Here is the code

<a href="#" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image11','','images/bt-chat2.jpg',1)" onClick="MM_openBrWindow('Login.asp','chat','top=1,left=1,scrollbars=yes,width=800,height=600')"><img name="Image11" border="0" src="images/bt-chat1.jpg" width="119" height="21"></a>

All references to images are valid, but still I get the "object expected" error,

If you want to see what I mean go to http://www.themusikmakers.com/pressreleases.htm.

Please help,

Cheers everyone. =:O

Ian
03-22-2001, 08:25 AM
Hi, you should reference the way the previous links have been done above your "chat" image and you will see why it is not working.

First of all, the code you have presented here is not the code on your page!!. Your page code is:


<a href="chat" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image16','','IMAGES/bt-chat2.jpg',1)" onClick="MM_openBrWindow('Login.asp','chat','ytop=1,left=1,scrollbars=yes,width=800,height=600,top=1,left=1')"><img name="Image16" border="0" src="IMAGES/bt-chat1.jpg" width="119" height="21"></a>

next I noticed that reference to these images are "IMAGES/..."!! all the other images are "images/...". If your server is case sensitive, it will not find these images. (change these to lower case)

Next: All the rest of your image functions are as follows:

<a href="mmstore.htm"
onClick="MM_nbGroup('down','group1','store','images/btn-store2.jpg',1)" onMouseOver="MM_nbGroup('over','store','images/btn-store2.jpg','images/btn-store2.jpg',1);MM_displayStatusMsg('The Musik Makers Store');return document.MM_returnValue" onMouseOut="MM_nbGroup('out');MM_displayStatusMsg('');return document.MM_returnValue" target="_self"><img name="store" src="images/btn-store1.jpg" border="0" onLoad="" width="135" height="20" alt="The Musik Makers Store"></a>

(NOTE: These ones work)

Compare it too:

<a href="chat" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('Image16','','IMAGES/bt-chat2.jpg',1)" onClick="MM_openBrWindow('Login.asp','chat','ytop=1,left=1,scrollbars=yes,width=800,height=600,top=1,left=1')"><img name="Image16" border="0" src="IMAGES/bt-chat1.jpg" width="119" height="21"></a>

-----------------------------------
where does ="MM_swapImage.." come from?? There is no function called this, shouldn't it be ="MM_nbGroup.."

next: Lets look in your brackets:
('Image16','','IMAGES/bt-chat2.jpg',1)"

this seems to be a few fields short of the one that works
('over','store','images/btn-store2.jpg','images/btn-store2.jpg',1);

What does "Image16" refer to?
and where is the corresponding part to this part?
;MM_displayStatusMsg('The Musik Makers Store');return document.MM_returnValue"

Now look at your mouseout function:

onMouseOut="MM_swapImgRestore()"

this seems to fall a bit short of
onMouseOut="MM_nbGroup('out');MM_displayStatusMsg('');return document.MM_returnValue" target="_self">

I also dont see a function for this:
="MM_swapImgRestore()" ??

I also don't see a function on your page called ="MM_openBrWindow" to open your new window.

I hope this helps.

stevef
03-22-2001, 09:29 AM
Thanks for your help on that last one Ian,

I now have a new problem, with the same thing.

<a href="#" onClick="MM_nbGroup('down','group1','chat','images/bt-chat1.jpg',1);MM_openBrWindow('Login.asp','chat','top=1,left=1,scrollbars=yes,width=800,height=600')";onMouseOver="MM_nbGroup('over','chat','images/bt-chat2.jpg','images/bt-chat1.jpg',1);MM_displayStatusMsg('The Musik Makers Chat');return document.MM_returnValue" onMouseOut="MM_nbGroup('out');MM_displayStatusMsg('');return document.MM_returnValue" target="_self""><img name="chat" src="images/bt-chat1.jpg" border="0" onLoad"" width="119" height="20" alt="The Musik Makers Chat"></a><br>

The code above is what has replaced the old code. I will admit that like my handle says, I am a bit of a novice. I have been handed this page to update, and the code already resident on the page was "faulty".

Would you mind just passing your ever diligent eyes over the above code, and let me know what I am being so thick about.

Cheers }:-)

Ian
03-22-2001, 11:21 AM
Hey Steve, no worries :)

the only thing I can see is two closing "'s here.

target="_self""

onMouseOut="MM_nbGroup('out');MM_displayStatusMsg('');return document.MM_returnValue" target="_self"">

try taking one out and see how you go :)

great work on cleaning up the code. :)

stevef
03-23-2001, 05:18 AM
Okay, now I am really confused.

I have (hopefully) done all that was required, have taken out the second closing ", and still no joy. I now get document.MM_nbOver.length coming up saying that it cannot be handled. I guess this is because it is not defined earlier in the code, so I am not too worried about it.

Other than that, after changing all the code to what has been recommended, I still get 'object expected' errors, but only when clicking on the Chat button.

Here is the code:

<a href="#" onClick="MM_nbGroup('down','group1','chat','images/bt-chat1.jpg',1);MM_openBrWindow('login.asp','chat','top=1,left=1,scrollbars=yes,width=800,height=600')";onMouseOver="MM_nbGroup('over','chat','images/bt-chat2.jpg','images/bt-chat2.jpg',1);MM_displayStatusMsg('The Musik Makers Chat');return document.MM_returnValue" onMouseOut="MM_nbGroup('out');MM_displayStatusMsg('');return document.MM_returnValue" target="_self"><img name="chat" src="images/bt-chat1.jpg" border="0" onLoad"" width="119" height="21" alt="The Musik Makers Chat"></a><br>

Any last ideas??

Anyone????

Thanks for all you help so far by the way.

Ian
03-23-2001, 07:55 AM
Hi,
make sure there is a space between your functions. (mouseover , onclick, etc) this has been run together.

width=800,height=600')";onMouseOver="MM_nbGroup

should be

width=800,height=600')"; onMouseOver="MM_nbGroup

The error you will be getting when you click the button is because it cannot find a function called "MM_openBrWindow" to execute. As I mentioned in the first post, there is no reference to this in your page source.
if you cannot find the original function to do this, you will have to adapt a window open script to put in its place.

you're slowly getting there, don't loose hope :)

BTW, can you make sure that the code is updated on your site each time so it can be checked, it always helps to actually see it working(or not) to fully understand the symptoms.