标签:
如何点击按钮更换样式
<img id="imgid" src="img/1.jpg">
<button onclick="demo()">点击</button>
<script>
function demo(){
document.getElementById("imgid").src="img/2.jpg"
}
</script>
如何使用句柄点击按钮弹出
<button id="bat">点击</button>
<script>
document.getElementById("bat").addEventListener("click",function
(){
alert("hello")
})
</script>
<button id="bat">点击</button>
<script>
x=document.getElementById("bat")
x.addEventListener("click",hello)
x.addEventListener("click",world)
function world(){
alert("world")
}
function hello(){
alert("hello")
}
</script>
标签:
原文地址:http://www.cnblogs.com/yinlu/p/4581444.html