View Full Version : Help! CSS and Javascript Photo Gallery
Chacala_Nayarit
Mar 4, 2006, 01:18 PM
This tested fine in Firefox, but IE 6 does not render. Meaning when the photos are clicked they do not open in a new window. http://rainiersupply.com/gallery.html
<ul id="albumlist">
<li><a href="javascript:void(0)" onclick="window.open('/images/500ftMCM.jpg','http://rainiersupply.com','width=500,height=375')"><img src="/thumbnails/500ftMCM.jpg" alt="500ftMCM" width="144" height="108" />500ft MCM</a></li>
IE 6 displays an error in the corner of the browser says something like invalid argument line: {every picture}, Code: 0, blah, blah, blah... :mad:
Where did I go wrong? Is there a better way to achieve this goal?
littlejim
Mar 5, 2006, 04:12 AM
I'm not in frpnt of a PC at the moment but I don't think IE6 PC likes void(0);
So (as an example) replace
<a href="javascript:void(0)" onclick="window.open('/images/500ftMCM.jpg','http://rainiersupply.com','width=500,height=375')"><img src="/thumbnails/500ftMCM.jpg" alt="500ftMCM" width="144" height="108" />500ft MCM</a>
with
<a href="window.open('/images/500ftMCM.jpg','http://rainiersupply.com','width=500,height=375')"><img src="/thumbnails/500ftMCM.jpg" alt="500ftMCM" width="144" height="108" />500ft MCM</a>
Chacala_Nayarit
Mar 5, 2006, 04:33 PM
Unfortunately the above code does not work. I just put an image link to get Firefox. So if they want to view the pictures, well than they have too download Firefox.:p
Coolnat2004
Mar 5, 2006, 08:36 PM
Hmm.. try this:
<a href="#" onclick="window.open('/images/500ftMCM.jpg','http://rainiersupply.com','width=500,height=375')"><img src="/thumbnails/500ftMCM.jpg" alt="500ftMCM" width="144" height="108" />500ft MCM</a>
hopejr
Mar 6, 2006, 04:15 AM
This will work:
<a href="javascript:window.open('/images/500ftMCM.jpg','http://rainiersupply.com','width=500,height=375')"><img src="/thumbnails/500ftMCM.jpg" alt="500ftMCM" width="144" height="108" />500ft MCM</a>
Knox
Mar 6, 2006, 05:29 AM
The way I normally do new windows in javascript is: (untested)
<a href="/images/500ftMCM.jpg" target="_blank" onClick="window.open(this.href, 'new', 'width=500,height=375');return false;"><img src="/thumbnails/500ftMCM.jpg" alt="500ftMCM" width="144" height="108" />500ft MCM</a>
This means that browsers without javascript enabled will work as normal, opening the image in a full size window.
redeye be
Mar 6, 2006, 06:00 AM
Just a remark on the side:
Although your javascript says 'width=500,height=375' and your image all are 500 x 375 the new window that opens always has scrollbars when i open them.
The actual part of the image shown is 485 x 359.
Shouldn't Safari (2.0.3) just show the image if it fits, it's by putting those bars that you need them.
Couldn't come up with a tag for forcing 'no scrollbars' on a new window, then again i really didn't look so hard (http://www.google.be/search?hl=nl&q=javascript+%22open+new+window+without+scrollbars%22&btnG=Google+zoeken&meta=).
Firefox (Mac and PC) and camino show the image in a window bigger than the set size.
Anyhow, i'm sorry for this OT post.
Cheers
Chacala_Nayarit
Mar 6, 2006, 11:09 AM
The way I normally do new windows in javascript is: (untested)
<a href="/images/500ftMCM.jpg" target="_blank" onClick="window.open(this.href, 'new', 'width=500,height=375');return false;"><img src="/thumbnails/500ftMCM.jpg" alt="500ftMCM" width="144" height="108" />500ft MCM</a>
This means that browsers without javascript enabled will work as normal, opening the image in a full size window.
Thank you! that's the one that works! I changed a few of them, but I stopped until the billing starts at 8:00am tomorrow. :D
vBulletin® v3.8.6, Copyright ©2000-2013, Jelsoft Enterprises Ltd.