What does "member not found" error mean?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • andersond
    New Member
    • Feb 2007
    • 110

    What does "member not found" error mean?

    I want input objects to have a light yellow background when they have focus. Here's how I call my function:

    Code:
    input name="monthsVacant" id="monthsVacant" disabled="disabled" onFocus="yellowOn('monthsVacant')"
    And here's my function.

    Code:
    function yellowOn(vObject){
     var vObject; //object being highlighted
     document.getElementById(vObject).style="background-color:#FFFFCC";
    }
    When the object gets focus I get an error message that says "member not found". What is it talking about? And how can I get this to work?
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    you are overwriting the function's argument, omit line #2. further, the background colour in JS can be accessed by style.backgroun dColor.

    nevertheless, a much easier approach would be using the this keyword:
    Code:
    function myfunction()
    {
      this.style.color = "red";
    }

    Comment

    • andersond
      New Member
      • Feb 2007
      • 110

      #3
      Code:
      function yellowOn(vObject){ 
      document.getElementById(vObject).style="background-color:#FFFFCC"; 
      }
      which results in "member not found"

      and

      Code:
      function yellowOn(vObject){ 
      document.getElementById(vObject).style.backgroundcolor="#FFFFCC"; 
      }
      which results in nothing at all

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        Originally posted by andersond
        which results in nothing at all
        JS is case sensitive, the property is called "backgroundColo r"

        Comment

        Working...