SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question Script only works in IE, not in Mozilla, opera...

    Hi All!

    First post here!

    I have the next problem:

    I've made a button in flash which changes the background of an layout table.
    I'm using javascript to make it work.
    works perfect in IE, but not in other browser.
    I can't figure out what i'm doing wrong..

    Code in flash ( for the button):

    on (press) {
    getURL("JavaScript:changeBgImage('images/bckgrnd1.jpg')");
    }
    code in javascript:

    <script>
    <!--

    function changeBgImage(newBgImage) {
    document.getElementById('index').background= newBgImage;
    }
    //-->
    </script>
    Mozilla's javascript console show no errors...

    help!

    greetz,
    Munchkin.

  2. #2
    CSS & JS/DOM Adept bronze trophy
    Join Date
    Mar 2005
    Location
    USA
    Posts
    5,482
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    background is not an X/HTML attribute of <table>.

    Use CSS.
    Code:
    document.getElementById('index').style.backgroundImage= 'url('+newBgImage+')';
    We miss you, Dan Schulz.
    Learn CSS. | X/HTML Validator | CSS validator
    Dynamic Site Solutions
    Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.

  3. #3
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanx ,
    it worked!

    really thanks alot for helping out this script newbie!!



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •