onsubmit, onload 이벤트 촉발, 행위 구조 분리

1839 단어
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="  http://www.itbool.com" />
</head>
    <body>
     <form action="m9.php" onsubmit="return t1()">
     <p><input type="text" /></p>
     <p><input type="text" /></p>
     <p><input type="submit" value=" "/></p>
     </form>
    </body>
    <script>
     //  onsubmit , 
     function t1 () {
     // body...
     alert(" ");
     return false;
     }
    </script>
</html>
/********************************
* ie ********/
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="description" content="  http://www.itbool.com" />
<style>
#div{
width: 200px;
height: 200px;
}
</style>
</head>
    <body>
     <p> , </p>
     <div>
     <ul>
     <li> </li>
     </ul>
     </div>
    </body>
    <script>
    //  , 
    document.getElementsByTagName('div')[0].onclick=function () {
     this.style.border="1px solid blue";
     // body...
    }
    </script>
</html>

좋은 웹페이지 즐겨찾기