function inside function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • oll3i
    Contributor
    • Mar 2007
    • 679

    #16
    now menu displays but onmouseover doesnt work i have an error "the object doesnt service the metod or the property"
    i use
    onMouseOver=\'t his.changeLinkS tyleOn(this.id) \' <---- this probably causes the error

    Comment

    • acoder
      Recognized Expert MVP
      • Nov 2006
      • 16032

      #17
      What is the onmouseover attached to? Don't forget that JavaScript is case-sensitive, so it should be lower-case.

      Comment

      • oll3i
        Contributor
        • Mar 2007
        • 679

        #18
        onmouseover is attached to a href
        Code:
        document.write('a href=\'/HRDB/candidates/\' id=\'candidates\' onclick=\'this.changeLinkStyleOn(this.id)\' onmouseover=\'this.changeLinkStyleOn(this.id)\' onmouseout=\'this.changeLinkStyleOut(this.id)\' );
        and these functions are defined as
        Menu.prototype. changeLinkStyle On = function(id){co de}

        Comment

        • acoder
          Recognized Expert MVP
          • Nov 2006
          • 16032

          #19
          Where is this document.write statement? Remember that you can't use document.write after the page has loaded, at least not for reliable results because it opens the document again for writing.

          Comment

          • oll3i
            Contributor
            • Mar 2007
            • 679

            #20
            Code:
            Menu.prototype.display= function(){ here document.write statements}
            and then in .jsp file
            Code:
            <script>
            var menu = new Menu(here variables passed);
            menu.display();
            </script>

            Comment

            • acoder
              Recognized Expert MVP
              • Nov 2006
              • 16032

              #21
              It'd probably be better to create the link dynamically rather than use document.write. In that statement, this would refer to the link, not the Menu object which is probably what you want. To refer to the menu, attach onclick/mouseover/out events dynamically outside the write.

              Comment

              Working...