Copy codeThe Code is as follows:
<! Doctype html public "-// W3C // dtd html 4.01 Transitional // EN">
<Html>
<Head>
<Title> simple event processing </title>
<Meta http-equiv = "keywords" content = "keyword1, keyword2, keyword3">
<Meta http-equiv = "description" content = "this is my page">
<Meta http-equiv = "content-type" content = "text/html; charset = UTF-8">
<! --
<Script language = "text/javascript" src = "hello.html"> the external call label of this js cannot be self-terminated </script>
<Link rel = "stylesheet" type = "text/css" href = "./styles.css">
-->
<Script type = "text/javascript">
Function clickD (obj ){
Alert (obj. innerHTML );
}
Function mouseD (obj ){
Obj. style. color = "# f00 ";
// When you use code to set the style, if the css is represented by "-", you must mark the font-size with the hump-> fontSize
Obj. style. fontSize = "16px ";
}
Function outD (obj ){
Obj. style. color = "#000 ";
Obj. style. fontSize = "18px ";
}
// With usage
With (document ){
Write ("dddd <br/> ");
}
Document. write ("aaaa <br/> ");
Document. write ("bbbb <br/> ");
Document. write ("cccc <br/> ");
</Script>
</Head>
<Body>
<Div onclick = "clickD (this)" style = "cursor: pointer;"> click it. </div>
<Div onmouseover = "mouseD (this)" onmouseout = "outD (this)"> move your mouse over it. </div>
</Body>
</Html>
2. Example of a browser object: "data transfer between two browser pages"
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 // EN"
Http://www.w3.org/TR/html4/strict.dtd>
<Html xmlns = "http://www.w3.org/1999/xhtml" lang = "en">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> js01_hello </title>
<Meta name = "author" content = "Administrator"/>
<Script type = "text/javascript">
// SetTimeout ("endWelcome ()", 5000 );
// Function endWelcome (){
// Document. getElementById ("welcome"). style. display = "none ";
//}
</Script>
</Head>
<Body>
<Div id = "welcome"> welcome to our website </div>
<A href = "#" onclick = "too many open('test02.html ', 'aaa', 'width = 300, height = 300, resizable = 0')"> test02 </a>
<A href = "#" onclick = "too many open('test03.html ', 'aaa', 'width = 400, height = 400, resizable = 0')"> test03 </a>
<Br/>
<A href = "#" onclick = "your preferred open('bless.html ', 'aaa', 'width = 600, height = 300')"> enter your preferred language </a>
<A href = "#" onclick = "your preferred open('bless.html ', 'aaa', 'width = 600, height = 300')"> select gender </a>
<Div id = "bless"> </div>
</Body>
</Html>
Copy codeThe Code is as follows:
<! DOCTYPE html PUBLIC "-// W3C // dtd html 4.01 // EN"
Http://www.w3.org/TR/html4/strict.dtd>
<Html xmlns = "http://www.w3.org/1999/xhtml" lang = "en">
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8"/>
<Title> js01_hello </title>
<Meta name = "author" content = "Administrator"/>
<Script type = "text/javascript">
Function bless (){
// Obtain the input slang
Var mb = document. getElementById ("mb"). value;
// Obtain the parent class window
Var p = window. opener;
// Obtain the div whose id is bless in the parent class window
Var pd = p.doc ument. getElementById ("bless ");
// Set the value of pd
Pd. innerHTML = mb;
// Close the current window
Window. close ();
}
</Script>
</Head>
<Body>
Input Syntax: <input type = "text" size = "40" id = "mb"/> <input type = "button" onclick = "bless () "value =" input "/>
</Body>
</Html>