DHTML编程的通常过程
DHTML编程的一般过程
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> <style type="text/css"> #div1{ background-color:#FF9900; height:100px; width:300px; } #div2{ background-color:#999999; width:300px; } </style> <script type="text/javascript"> function seldemo() { var selNode = document.getElementById("selid"); var value = selNode.options[selNode.selectedIndex].value; var divNode1 = document.getElementById("div1"); var divNode2 = document.getElementById("div2"); divNode1.style.textTransform = value; divNode2.innerText = "text-transform : "+value+" ;"; } </script> </head> <body> <!-- DOM编程: 1,定义界面: 通过html的标签将数据进行封装。 2,定义一些静态的样式。 通过css。 3,需要动态的完成的和用户的交互。、 a,先明确事件源。 b,明确事件将事件注册到事件源上。 c,通过javascript的函数对象事件进行处理。 d,在处理过程需要明确被处理的区域。 --> <div id="div1"> Good good study,Day day up! </div> <p></p> <select id="selid" onchange="seldemo()"> <option value="none">--none--</option> <option value="uppercase">大写</option> <option value="lowercase">小写</option> </select> <p></p> <div id="div2"> text-transform : none ; </div> </body> </html>