settime method
sets the value of a date object.
语法
dateobjectname.settime(timevalue)
dateobjectname is either the name of a date object or a property of an existing object.
timevalue is an integer or a property of an existing object, representing the number of milliseconds since the epoch (1 january 1970 00:00:00).
方法
描述
use the settime method to help assign a date and time to another date object.
例子
thebigday = new date("july 1, 1999")
sameasbigday = new date()
sameasbigday.settime(thebigday.gettime())
相关
settimeout method
evaluates an expression after a specified number of milliseconds have elapsed.
语法
timeoutid=settimeout(expression, msec)
timeoutid is an identifier that is used only to cancel the evaluation with the cleartimeout method.
expression is a string expression or a property of an existing object.
msec is a numeric value, numeric string, or a property of an existing object in millisecond units.
方法
描述
the settimeout method evaluates an expression after a specified amount of time. it does not evaluate the expression repeatedly. for example, if a settimeout method specifies 5 seconds, the expression is evaluated after 5 seconds, not every 5 seconds.
例子
example 1. the following example displays an alert message 5 seconds (5,000 milliseconds) after the user clicks a button. if the user clicks the second button before the alert message is displayed, the timeout is canceled and the alert does not display.
example 2. the following example displays the current time in a text object. the showtime() function, which is called recursively, uses the settimeout method update the time every second.
相关
setyear method
sets the year for a specified date.
语法
dateobjectname.setyear(yearvalue)
dateobjectname is either the name of a date object or a property of an existing object.