Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Can't assign image source in firefox
Old 05-28-2008, 02:47 PM Can't assign image source in firefox
cjreynolds's Avatar
Novice Talker

Posts: 6
Name: Joe Reynolds
Trades: 0
I have a site that I've coded to detect the user's screen resolution and adjust the layout accordingly. I do this using JS to re-assign CSS classes and swap images. Works great - until you view it in firefox (big surprise). The class re-assignments work OK, but I can't swap image sources - works fine in IE, not in fx.

I'm using:
Code:
 
topBannerImg.src="images/sbdc_banner_800.jpg"
I really don't want to bash firefox - actually, yes I do...

Does anyone know what the problem might be, and how to work around it?

joe
cjreynolds is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 05-28-2008, 04:48 PM Re: Can't assign image source in firefox
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
are you sure you aren't looking for something more like this?
Code:
document.getElementById('topBannerImg').src="sbdc_banner_800.jpg";
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.

Last edited by wayfarer07; 05-28-2008 at 04:50 PM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-28-2008, 06:05 PM Re: Can't assign image source in firefox
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
The problem is that IE is 97% of the market and you spend 60% of your time on cross browser compatibility.

Want another good reason to give it up? Check out microsofts expression statement for CSS it applies directly to what you are doing, but alas it only works in IE.

I have been diddling with computers since 1974 and Microsoft has always done an extremely fine job with software, I have given up on cross browser compatibility, although FireFox is an excellent trouble shooting tool.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 05-28-2008, 06:58 PM Re: Can't assign image source in firefox
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Quote:
The problem is that IE is 97% of the market and you spend 60% of your time on cross browser compatibility.
Uhmmm... not even close. IE has slightly less than 70% of the browser market. As of May 29th of last year, Firefox owns 25% (!) of the worldwide browser market. http://www.idm.net.au/story.asp?id=8468 And that doesn't even include Safari, Opera, and Linux products.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.

Last edited by wayfarer07; 05-29-2008 at 01:08 AM..
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-28-2008, 08:24 PM Re: Can't assign image source in firefox
Sleeping Troll's Avatar
Ultra Talker

Posts: 351
Name: Butch Begy
Trades: 0
Yeah, you can find all kinds of numbers on the web. I saw a statement one time claiming that Apache had surpassed IIS for E-commerce, a little investigation showed that was false also.
Sleeping Troll is offline
Reply With Quote
View Public Profile
 
Old 05-28-2008, 08:42 PM Re: Can't assign image source in firefox
logic ali's Avatar
Super Talker

Posts: 104
Trades: 0
Quote:
Originally Posted by cjreynolds View Post
I'm using:
Code:
 
topBannerImg.src="images/sbdc_banner_800.jpg"
I really don't want to bash firefox - actually, yes I do...

Does anyone know what the problem might be, and how to work around it?
What is topBannerImg? Not a reference to an image object I suspect.
The problem is that I.E. accepts sloppy syntax; someone has already given the solution.
logic ali is offline
Reply With Quote
View Public Profile
 
Old 05-29-2008, 01:05 AM Re: Can't assign image source in firefox
wayfarer07's Avatar
Poo on You

Latest Blog Post:
Introducing WowWindow
Posts: 3,987
Name: Abel Mohler
Location: Asheville, North Carolina USA
Trades: 0
Have you looked at your own links? The only one with 90%+ popularity for Explorer is from 2002, while the other two show explosive growth for Firefox, as they are more recent.
__________________
I build web things. I work for the startup
Please login or register to view this content. Registration is FREE
.
wayfarer07 is offline
Reply With Quote
View Public Profile Visit wayfarer07's homepage!
 
Old 05-29-2008, 10:53 AM Re: Can't assign image source in firefox
cjreynolds's Avatar
Novice Talker

Posts: 6
Name: Joe Reynolds
Trades: 0
Code:
 
document.getElementById('topBannerImg').src="sbdc_banner_800.jpg";
I should've figured that out - my brain was out to lunch. I had gotten accustomed to using the shorthand syntax - IE tolerated it, so I got complacent...

Thanks for the help (and the spirited firefox discussion - I enjoy a good debate!)

joe
cjreynolds is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Can't assign image source in firefox
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.28622 seconds with 12 queries