div 未做

Original 2019-02-03 15:08:46 204
abstract:<!DOCTYPE html><html><head><meta charset="UTF-8"><title>javascript之事件的使用方法</title></head><body><script type="text/javascript">

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<title>javascript之事件的使用方法</title>

</head>

<body>

<script type="text/javascript">

function shijian1(x) {

x.style.background="green"

//为什么我用backgroudcolor就不行呢?老师

}

function shijian2(y) {

y.style.background="red"

}

function shijian3() {

Document.getElementById("a").value="who cares!"

}

function shijian4() {

alert("你确定提交了吗?不好好考虑一下了")

}


</script>

1. onfocus:<input type="text" style="width:800px ;height:50px; border-radius: 200px;font-size: 28px;" onfocus="shijian1(this)" value="我是onfocus,点击这里会变绿哦!不信你试试" onblur="shijian2(this)"> <br><br>

<!-- // value值是框里的提示信息 -->

2. onmouseover:<input type="text" style="width:800px ;height:50px; border-radius: 400px;font-size: 28px;" value="我是onmouseover,鼠标到这里这里会变红哦!不信你试试" onmouseover="shijian2(this)"> <br><br>

3. onmouseup:<input type="text" style="width:800px ;height:50px; border-radius: 400px;font-size: 28px;" value="我是onmouseup,鼠标键抬起,这里这里会变红哦!不信你试试" onmouseup="shijian2(this)"> <br><br>

4.onmouseout:<input type="text" style="width:800px ;height:50px; border-radius: 400px;font-size: 28px;" value="我是onmouseout,当鼠标移开" onmouseover="shijian1(this)"> <br><br>

5.鼠标按下onmousedown:<input type="text" style="width:800px ;height:50px; "onmousedown="shijian1(this)"> <br><br>

6.onclick   <button type='button' onclick="shijian1(this)">点我!</button> <br><br>

7.ondbclick  <button type='button' onclick="shijian2(this)">双击点我!</button> <br><br>

8.onblur 写进第一条了 <br><br>

9.onchange<input type="text" id="a" style="width:800px ;height:50px; "  onchange="shijian3(this)" > <br><br>

<!-- onchange不会用 -->

10.onsubmit   <button type='button' onclick="shijian4(this)">提交!</button> <br><br><br><br>

<!-- 不会用提交功能,还不如用onclick呢是不是? -->

</body>

</html>



Correcting teacher:天蓬老师Correction time:2019-02-03 15:22:15
Teacher's summary:alert("你确定提交了吗?不好好考虑一下了") 应该用confirm()

Release Notes

Popular Entries