Results 1 to 3 of 3

Thread: TypeError: this.getElementsByTagName is not a function

  1. #1
    Join Date
    Feb 2013

    TypeError: this.getElementsByTagName is not a function

    Hello I keep getting this error

    TypeError: this.getElementsByTagName is not a function

    the part of the code that this is refering to is required by my teacher. here is my code that is giving me the problem, I am new to javascript and my teacher is not very helpful so any kind of help is appreciated.

    function showSlide(){

    var slideList=this.getElementsByTagName("ul")[0];




    here are the instructions for this part of the code

    6. Add the showSlide() function to the file. The purpose of this function is to display a
    sliding menu on the Web page. In the first line of the function, create a variable
    named slideList that stores an object reference to the first ul element nested within
    the current object (as referenced by the this keyword).
    7. Add an if statement to the showSlide() function. The purpose of the if statement is to
    test whether a sliding menu is currently displayed on the page. If the currentSlide
    object is not equal to null and the ID of the currentSlide is equal to the ID of the
    slideList variable, then run the closeSlide() function; otherwise, do the following:
    a. Run the closeSlide() function.
    b. Set the currentSlide variable equal to the slideList variable.
    c. Set the display style of the currentSlide variable to block.
    d. Run the moveSlide() function repeated at intervals of 1 millisecond. Store the ID
    of the timed function in timeID.

    again any kind of help is appreciated even if it is to a link that may give me more information than my book.

  2. #2
    Join Date
    Mar 2007
    How is showSlide called?
    Where used, return should be executed unconditionally and always as the last statement in the function.

    That's my signature, it's not part of the damn post!

  3. #3
    Join Date
    Dec 2005
    In this statement:
    var slideList=this.getElementsByTagName("ul")[0];
    ...what is the 'this' referring to? The document? The function? The 'ul'?

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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