IE javascript, how to change style of element (works in firefox)

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • phfle1
    New Member
    • Oct 2007
    • 27

    IE javascript, how to change style of element (works in firefox)

    Hi,

    I need to change the style of an element and it seems to work fine in FF, but not in IE.

    Here's my statement :

    ucId.style.curs or = 'wait';

    where ucId is a user control created by vb.net.

    Is my sintax ok for IE?

    Thanks
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    The syntax is correct - see link.

    How are you referring to this user control element? Do you get any errors?

    Comment

    • phfle1
      New Member
      • Oct 2007
      • 27

      #3
      here is my function

      [CODE=javascript]function wait(ucId)
      {
      var browser;
      document.body.s tyle.cursor = 'wait';
      var tab = getElementsByID (ucId);
      ucId.syle.curso r = 'wait';
      }
      [/CODE]
      on execution, ucId = "ctl00_PlaceHol derMain_usrPage Transactionnell e"

      but I get an error : object needed on the line

      var tab = getElementsByID (ucId);

      Something weird about that is that the ucId is not present in the source of the html page.
      Last edited by acoder; Nov 9 '07, 06:29 PM. Reason: Added code tags

      Comment

      • acoder
        Recognized Expert MVP
        • Nov 2006
        • 16032

        #4
        First of all, the syntax is incorrect. It should be document.getEle mentById(ucId). JavaScript is case-sensitive. Note no "s" and D is lower-case.

        Secondly, on the last line, you should be using the object (tab.style.curs or), not the ID.

        Comment

        • phfle1
          New Member
          • Oct 2007
          • 27

          #5
          thanks for the help

          -P

          Comment

          • acoder
            Recognized Expert MVP
            • Nov 2006
            • 16032

            #6
            You're welcome. Glad you got it working.

            Comment

            Working...