Exforsys
+ Reply to Thread
Results 1 to 2 of 2

JavaScript setTimeout method

This is a discussion on JavaScript setTimeout method within the Java forums, part of the Programming Talk category; Does setTimeout method in JavaScript cause memory leak? Please let me know....

  1. #1
    Martin Lucas is offline Junior Member Array
    Join Date
    Feb 2006
    Answers
    10

    JavaScript setTimeout method

    Does setTimeout method in JavaScript cause memory leak? Please let me know.


  2. #2
    BhupendraSingh is offline Junior Member Array
    Join Date
    Dec 2011
    Answers
    2
    This method is used to call a function or evaluate an expression after a specified number of milliseconds. If an expression is to be evaluated, it must be quoted to prevent it being evaluated immediately. Note that the use of this method does not halt the execution of any remaining scripts until the timeout has passed, it just schedules the expression or function for the specified time.

    The following example opens a new window and uses the setTimeout method to call the winClose() function which closes it after five seconds (5000 milliseconds).

    Code:
    function winClose() {
    myWindow.close()
    }

    myWindow = window.open("", "tinyWindow", 'width=150, height=110')
    myWindow.document.write("This window will close automatically after five seconds. Thanks for your patience")
    self.setTimeout('winClose()', 5000)


Latest Article

Network Security Risk Assessment and Measurement

Read More...