<div class="codetitle"> <span><a style="CURSOR: pointer" data="21209" class="copybut" id="copybut21209" onclick="doCopy('code21209')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code21209"> <br><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <br><html> <br><head> <br><title>Simple event handling</title> <br><br><meta http-equiv ="keywords" content="keyword1,keyword2,keyword3"> <br><meta http-equiv="description" content="this is my page"> <br><meta http-equiv="content -type" content="text/html; charset=UTF-8"> <br><br><!-- <BR><script language="text/javascript" src="hello.html"> ;The external call tag of this js cannot end automatically</script> <br><link rel="stylesheet" type="text/css" href="./styles.css"> <br>--> ; <br><script type="text/javascript"> <br>function clickD(obj){ <br>alert(obj.innerHTML); <br>} <br><br>function mouseD(obj) { <br>obj.style.color = "#f00"; <br>//When using code to set the style, if the css is represented by -, it must be marked with camel case font-size -> fontSize <br>obj.style.fontSize = "16px"; <br>} <br>function outD(obj){ <br>obj.style.color = "#000"; <br>obj.style.fontSize = " 18px"; <br>} <br><br>//Usage of with <br>with(document){ <br>write("dddd<br/>"); <br>} <br>document. write("aaaa<br/>"); <br>document.write("bbbb<br/>"); <br>document.write("cccc<br/>"); <br>< ;/script> <br></head> <br><br><body> <br><div onclick="clickD(this)" style="cursor:pointer;">Click and try </div> <br><div onmouseover="mouseD(this)" onmouseout="outD(this)"> Try moving the mouse</div> <br><br></body> <br></html> <br> </div> <br>2. Example of browser object: "It involves value transfer between two browser pages" <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="12923" class="copybut" id="copybut12923" onclick="doCopy('code12923')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code12923"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" <BR>"http://www.w3.org/TR/html4/strict.dtd"> <br><br><br><html xmlns="http://www.w3.org/1999/xhtml " lang="en"> <br><head> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <br>< ;title>js01_hello</title> <br><meta name="author" content="Administrator" /> <br><script type="text/javascript"> <br>// setTimeout(" endWelcome()",5000); <br>// function endWelcome() { <br>// document.getElementById("welcome").style.display = "none"; <br>// } <br>< ;/script> <br></head> <br><body> <br><div id="welcome">Welcome to our website</div> <br><a href= "#" onclick="window.open('test02.html','aaa','width=300,height=300,resizable=0')">test02</a> <br><a href= "#" onclick="window.open('test03.html','aaa','width=400,height=400,resizable=0')">test03</a> <br><br/> ; <BR><a href="#" onclick="window.open('bless.html','aaa','width=600,height=300')">Enter your blessing</a> ; <BR><a href="#" onclick="window.open('bless.html','aaa','width=600,height=300')">Select gender</a> <br><div id="bless"></div> <br></body> <br></html> <br> </div> <br><div class="codetitle"> <span><a style="CURSOR: pointer" data="90897" class="copybut" id="copybut90897" onclick="doCopy('code90897')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code90897"> <br><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" <BR>"http://www.w3.org/TR/html4/strict.dtd"> <br><br><html xmlns="http://www.w3.org/1999/xhtml" lang="en"> <br><head> <br><meta http-equiv= "Content-Type" content="text/html; charset=utf-8" /> <br><title>js01_hello</title> <br><meta name="author" content="Administrator" / > <br><script type="text/javascript"> <br>function bless() { <br>//Get the input blessing <br>var mb = document.getElementById("mb"). value; <br>//Get the parent window <br>var p = window.opener; <br>//Get the div with id bless in the parent window <br>var pd = p.document.getElementById(" bless"); <br>//Set the value of pd<br>pd.innerHTML = mb; <br>//Close the current window<br>window.close(); <br>} <br></script> ; <br></head> <br><body> <br>Input blessing words:<input type="text" size="40" id="mb"/><input type=" button" onclick="bless()" value="Enter" /> <br></body> <br></html> <br> </div>