reportingsjr Posted August 6, 2006 Share Posted August 6, 2006 I know this may sound stupid and I dont feel like googling atm, but how woujld you use the css style thing in javascript to define a url of an image? Heres what I tried, but im guessing you still have to use the url() declaration since it is still css. div.style.background-image = 'http://domain.com/image.png';.So to you javascript gurus what do I do to get this to work? Link to comment Share on other sites More sharing options...
Chocolate570 Posted August 6, 2006 Share Posted August 6, 2006 div.style.backgroundImage="url('image url')";Should work. I think :)Or you could just do:div.background="url of image"Tell me if neither works. I'm slightly sleepy right now. Link to comment Share on other sites More sharing options...
reportingsjr Posted August 6, 2006 Author Share Posted August 6, 2006 Okay, both your way are diff. from mine.. Link to comment Share on other sites More sharing options...
joecoolaug Posted August 14, 2006 Share Posted August 14, 2006 I'm not entirely sure what you want... but I've got a suggestion, and I'm not sure if it will work.To define the Background COLOR or IMAGE in javascript <script> tag \\This one will only work for background COLORSdocument.getElementById("divID").bgColor="#CCCCCC"\\I doubt that this next one will work, but you could try it.\\If it works, it will work for background IMAGESdocument.getElementById("divID").background="http://www.domain.com/image.png" To define the Background image in CSS <style> tag \\This SHOULD workdiv.style.backgroundImage.url()\\something like that Link to comment Share on other sites More sharing options...
aspnetguy Posted August 15, 2006 Share Posted August 15, 2006 you are just copying the answers already given. If you continue to do this you will receive a warning. Stop spamming! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now