invalid argument in IE, yet everything fine in FireFox, no syntax error reported

Discussion in 'Javascript' started by lkrubner@geocities.com, Jul 16, 2005.

  1. Guest

    Look at this page:

    http://www.lauradenyes.com/test3.html


    It contains this function:


    <script type="text/javascript">
    function changeBackgroundImageZ (imageToChangeTo) {
    var thisDiv = document.getElementById("imageDiv");
    var urlInfo = "url('";
    urlInfo += imageToChangeTo;
    urlInfo += "');";
    thisDiv.style.backgroundImage = urlInfo;
    }
    </script>


    IE dies on the final line of this function and it complains that it is
    getting an "invalid argument". But FireFox plays this without
    complaint, and without any syntax error reported in the FireFox
    debugger.
     
    , Jul 16, 2005
    #1
    1. Advertising

  2. Jc Guest

    wrote:
    > <script type="text/javascript">
    > function changeBackgroundImageZ (imageToChangeTo) {
    > var thisDiv = document.getElementById("imageDiv");
    > var urlInfo = "url('";
    > urlInfo += imageToChangeTo;
    > urlInfo += "');";
    > thisDiv.style.backgroundImage = urlInfo;
    > }
    > </script>
    >
    >
    > IE dies on the final line of this function and it complains that it is
    > getting an "invalid argument". But FireFox plays this without
    > complaint, and without any syntax error reported in the FireFox
    > debugger.


    IE doesn't like the semicolon after the closing parentheses. Here's an
    example from
    http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/backgroundimage.asp:

    this.style.backgroundImage='url(sphere.jpeg)'
     
    Jc, Jul 16, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Daniel Walzenbach
    Replies:
    7
    Views:
    616
    Steven Cheng[MSFT]
    Feb 10, 2004
  2. Rolf Kemper
    Replies:
    0
    Views:
    385
    Rolf Kemper
    Oct 15, 2004
  3. Good Night Moon
    Replies:
    9
    Views:
    293
    Rick DeNatale
    Jul 25, 2007
  4. lolveley
    Replies:
    3
    Views:
    213
  5. Audrius
    Replies:
    5
    Views:
    125
    Audrius
    Sep 16, 2005
Loading...

Share This Page