PDA

View Full Version : using rollover buttons with Dynamic Ajax Content



nebstar
12-08-2008, 06:45 PM
1) Script Title: Dynamic Ajax Content

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

3) Describe problem: sorry it's my first post on a forum, I'm a designer and I'm trying to set up my new site so it will load html pages into a div.

I have read all the threads possible but do not really understand coding that well, so my apologies if i am going over stuff that's already been posted.

nb: using dreamweaver to create my site.

I have had a play with the files that accompany the ajax script and have been trying to get a rollover image to work with it by inserting it where the text links are in the code ( left hand column div) but the links don't work?

the code that dreamweaver inserts is:


<a href="javascript:ajaxpage('ajaxfiles/external.htm', 'rightcolumn');"></a><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image1','','/images/buttons/about_over.gif',1)"><img src="/images/buttons/about_up.gif" name="Image1" width="53" height="28" border="0" id="Image1" /></a>

however when I place a normal image the link works fine
again code used by dreamweaver


<a href="javascript:ajaxpage('ajaxfiles/external.htm', 'rightcolumn');"><img src="/images/buttons/about_up.gif" /></a>

if anyone could please help me to make this work with the roll over i would be very grateful.

jscheuer1
12-08-2008, 08:14 PM
The first link in your two link combo has no trigger text or image to click on, and it would be better to use just one link. There are better ways to do rollovers, but if you like DW's MM system, or just want to use it because you are familiar with it, this should work:


<a href="javascript:ajaxpage('ajaxfiles/external.htm', 'rightcolumn');"
onmouseout="MM_swapImgRestore();"
onmouseover="MM_swapImage('Image1','','/images/buttons/about_over.gif',1);"
><img src="/images/buttons/about_up.gif" name="Image1"
width="53" height="28" border="0" id="Image1" alt=""></a>

In an unrelated matter, using (as the demo page instructs) a javascript: href without an onclick event can be problematic, so it would be better to:


<a href="ajaxfiles/external.htm"
onclick="ajaxpage(this.href, 'rightcolumn'); return false;"
onmouseout="MM_swapImgRestore();"
onmouseover="MM_swapImage('Image1','','/images/buttons/about_over.gif',1);"
><img src="/images/buttons/about_up.gif" name="Image1"
width="53" height="28" border="0" id="Image1" alt=""></a>

nebstar
12-08-2008, 08:33 PM
Thanks for your reply John, I will try this out.
very much appreciated.