Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > javascript bg image

Reply
Thread Tools

javascript bg image

 
 
warth33@hotmail.com
Guest
Posts: n/a
 
      02-28-2008
Hello

I have to change a div's background image on the fly. The problem is
that the url is built on the fly too.

var url = link.replace("a", "b");

Thus the location of the image is contained in the variable url. How
do I pass this to the function?

document.getElementById('img_div').style.backgroun dImage = "url( '" +
url + "') ";

This of course didnt work. I have tried a lot of alternatives, putting
\ almost everywhere. But none worked. is there a solution to this?
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Image Viewer from Image Map Ryan Sullivan Javascript 3 11-24-2005 09:09 AM
wx.Image: Couldn't add an image to the image list. Laszlo Zsolt Nagy Python 1 01-26-2005 09:55 PM
Image can't hold an image? Gary B ASP .Net 3 08-01-2003 01:31 AM
How To Browse for an image file and save it to image server folder Mike John ASP .Net 0 07-28-2003 04:55 PM
Streaming Image data to an image viewer Jerry J ASP .Net 0 07-18-2003 01:33 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57