One, getComputedStyle (document.getElementById ("Div1"). width) is incompatible under ie6,7,8;
document.getElementById ("Div1"). Currentstyle.width is incompatible under standard browsers
Workaround: Attribute judgment
With the above two methods, the following questions should be noted:
- Gets the computed style of the computer (browser)
- Background:url () Red ... Compound style (do not get)
- BackgroundColor single style (not to make judgments)
- Do not have spaces
- Do not get a style that is not set: incompatible
Second, the timer
- SetTimeout ("function", time) sets a timeout object, in milliseconds
- SetInterval ("function", time) sets a timeout object, in milliseconds
- SetInterval is auto-repeating, settimeout does not repeat and executes only once.
- Cleartimeout (object) clears the SetTimeout object that has been set
- Clearinterval (object) clears the SetInterval object that has been set
Note that when setting the SetInterval, if the timer is controlled by the event, it is advisable to shut it down and avoid setting the timer problem more than once.
JS Basics-Get style without setting inline elements, timer