1. Disable Div selection:
$ (Dataid). BIND ("selectstart", function () {// ie disable Div Selection
Return false;
}
Optional (dataid).css ("-moz-user-select", "NONE"); // FF disable Div Selection
2. Window. Close () (all windows opened through window. Open can be closed)
Firefox uses JavaScript: window. Close () to close a click link or a new window. It cannot close a window opened by entering the address bar;
Ie can be disabled directly
3. Event source srcelement and target
VaR elemente.tar GET | E. srcelement; // e.srcelementis under IE, and e.tar get is under FF
4. offset ()
When using the offset () method to set coordinates, it is best to set the top and left attributes of CSS in IE, otherwise the wrong coordinates will be generated.
For example
<! Doctype HTML public "-// W3C // dtd html 4.01 // en" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
<SCRIPT type = "text/JavaScript" src = "lib/jquery/jquery-1.4.2.js"> </SCRIPT>
<Title> untitled document </title>
<SCRIPT type = "text/JavaScript">
$ (Function ()
{
$ ("# Aa"). offset ({top: 0, left: 0 });
Alert ($ ("# Aa"). offset (). Top); // here it is inexplicably 92
$ ("# AABC"). Click (function ()
{
$ ("# Aa"). offset ({top: 0, left: 0 });
})
});
</SCRIPT>
<Style type = "text/CSS">
# Bb
{
Top: 20px;
}
# Aa
{
Top: 30px; // No attribute is set.-92 is displayed on the top, and the value is 0. It is better to set the top and left attributes first. Otherwise, unexpected results will be generated.
Position: absolute;
}
</Style>
</Head>
<Body>
<Div style = "height: 60px;" id = "BB" style = "Top: 10px;"> </div>
<Input type = "button" value = "test" id = "AABC"/>
<! -- Template HTML -->
<Div id = "AA">
Aaaaaa </BR>
Bbbbbb </BR>
Cccccc </BR>
</Div>
</Body>
</Html>