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
What am I doing wrong? bg image swap.
Old 01-30-2007, 02:51 AM What am I doing wrong? bg image swap.
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
Hi,

I put together a an article on black and white conversions in Photoshop. There are a lot of possibilities for any given photo, and some of them look better than others.

To save real estate, I'm using an img ( with a transparent frame ) and javascripts to swap out the background image. The first two ( color channels and conversion modes ) work perfectly, but the last does nothing. And I can't tell what the difference is. The images are where they're supposed to be, the java is almost identical ( and doesn't offend FireFox ), and the html it's embedded in is similar.

This is broken, and I don't understand how:
Code:
  <img src="/GraphicElements/ArticlePhotoFrame810.png" style="background-image:url(/Articles/DigitalBW/Color_2.jpg)" alt="" id="SecondImage" class="articlePhoto500x400" />

  <a href="javascript:BW_ShowSepia2()">Sepia</a>
Code:
function BW_ShowSepia2() { document.getElementById("SecondImage").style.backgroundImage = "url(/Articles/DigitalBW/Sepia2.jpg)"; }
Any thoughts?
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
 
Register now for full access!
Old 01-31-2007, 02:17 PM Re: What am I doing wrong? bg image swap.
foobar's Avatar
Extreme Talker

Posts: 225
Trades: 0
Try changing

Code:
document.getElementById("SecondImage").style.backgroundImage = "url(/Articles/DigitalBW/Sepia2.jpg)";
to

Code:
document.getElementById("SecondImage").style = "background-image: url(/Articles/DigitalBW/Sepia2.jpg)";
foobar is offline
Reply With Quote
View Public Profile Visit foobar's homepage!
 
Reply     « Reply to What am I doing wrong? bg image swap.
 

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.62863 seconds with 12 queries