Click to See Complete Forum and Search --> : targetting two iframes
alex57
08-04-2007, 03:59 PM
Hello,
How would I target two iframes with two different pages. EG. I have 'iframe1' and 'iframe2'. I know this code is ridiculous but something to this effect:
<a href='gallery.php' target='iframe1' href='gallerymenu.php' target='iframe2'>click</a>
Thanks
PS. i would like to avoid an onclick event as something like this gets messy in Javascript when the html is written in Javascript due to quotes.
<A HREF='GalleryMenu.html' target='left' onClick='parent.frames[1].location.href='GalleryAlbums.php''"
Changing 2 iframes requires onclick event:<a href="gallery.php" target="iframe1" onclick="iframe1.location.href='gallery.php'; iframe2.location.href='gallerymenu.php'; return false;">click</a>
alex57
08-05-2007, 01:11 PM
That is what i thought. However, I need to write that in javascipt e.g. using document.write().
How would i got about doing that as the quotations get me confused in this case.
thanks
Ferret
08-05-2007, 05:56 PM
If you ever need to make a quotation mark in a document.write, use:
document.write("this is a /"string/"")
//The /" tells the javascript not to use that " as the end of the string.
http://www.w3schools.com/js/js_special_characters.asp for more information. ^^
alex57
08-05-2007, 06:49 PM
document.write("<A HREF='GalleryMenu.html' target='left' onClick='parent.frames[1].location.href=/"GalleryAlbums.php/"");
this doesnt work though. I am not sure of the syntax around the GalleryAlbums section of code as the onclick event is already in single quotes??
Ferret
08-05-2007, 07:25 PM
document.write("<A HREF='GalleryMenu.html' target='left' onClick='parent.frames[1].location.href=/"GalleryAlbums.php/"'>");
Might that be your problem?
document.write('<a href="gallery.php" target="iframe1" onclick="iframe1.location.href=\'gallery.php\'; iframe2.location.href=\'gallerymenu.php\'; return false;">click<\/a>');
alex57
08-06-2007, 10:57 AM
Still no luck with this, I think this is a definite flaw with Javascript. however I have got round it by creating a function for the onclick event and the work is now done outside of the <a> element. Creating functions for the rollovers may take some time :P
Messy but it works. Thanks for all your help.