PDA

View Full Version : stops loading after using clicks to open a new window


ourweehome
08-15-2003, 11:59 AM
Hi all,
I am new to javascript, and am having a real problem with this:

<a href="javascript:;" onClick="MM_openBrWindow('this.htm','','scrollbars=yes,resizable=yes,width=600,height=200)">

When the user clicks a thumbnail to open a larger version in a new window, the thumbnails on the main page stop loading. Please could someone help me with this. Is there a way round it?

Any links to good tutorials, or any help whatsoever will be greatly appreciated! :)

Thanks all!

Vladdy
08-15-2003, 01:45 PM
Big picture: DW (MM_ is Dreamweaver ... or is it Front Page - same POS WYSI!WYG editors....) gives you crappy code.

Make sure the onclick processing function returns false.

ourweehome
08-15-2003, 02:11 PM
Thanks Vladdy,
I know! Dreamweaver does give crappy code, but since I am new to javascript, it is quite a good learning tool - learning from other peoples mistakes that is!

Do you mean add:
return false;
at the end of this:
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}

Again, I appreciate the help, thanks! :)

Vladdy
08-15-2003, 02:34 PM
Yeap,

..actually you can dump the DW wrapper alltogether:

<a href="myfile.html" onClick="window.open(this.href, '', 'scrollbars=yes, resizable=yes, width=600, height=200'); return false;">

If you do it the way I shown, the link will still work for someone with javascript disabled making your page much more accessible.

ourweehome
08-15-2003, 03:20 PM
Wonderful!! Genius!
Thanks so much. I've been wondering how to do that for ages. You're a star! ;)