事件处理

</head>
<body onload ="mgs()">
<form id="form1" runat="server">
<div id ="div" class = "div" onmouseover="onOver()" onmouseout ="onOut()">
<button onclick ="onClick()">按钮</button>
<input type ="text" onchange ="onChange()" />
<input id ="idT" type ="text" onselect ="alert('文本框选中了文字')" onfocus="onFocus()"/>
<script>
function onOver()
{
document.getElementById("div").style.background ="blue";
}
function onOut()
{
document.getElementById("div").style.background ="red";
}
function onClick()
{
alert("按钮点击了");
}
function onChange(bg)
{
alert("内容改变");
}
function onFocus() //光标聚集事件
{
document.getElementById("idT").style.background ="green";
}
function mgs()
{
alert ("网页加载完毕");
}
</script>
</div>
</form>
</body>
</html>