1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > HTML button标签

HTML button标签

时间:2019-06-02 12:46:26

相关推荐

HTML button标签

如果<button>标签在<form>中不加type=“button”,那么默认含义是“submit”。

<button>标签里面disabled属性使其不可用,常见javascript修改disabled属性实例:(a键b键互相撕逼)

<style>#a,#b{height:30px;width:70px;background:yellow;box-sizing:border-box;}</style></head><body><button type="button" id="a" οnclick="an()" >会变色</button><button type="button" id="b" οnclick="bn()" >会变色</button><script>function bn(){if(document.getElementById("b").disabled!="true"){document.getElementById("b").disabled="true";document.getElementById("b").style.background="gray";document.getElementById("a").removeAttribute("disabled");document.getElementById("a").removeAttribute("style");}else{document.getElementById("a").disabled="true";document.getElementById("a").style.background="gray";document.getElementById("b").removeAttribute("disabled");document.getElementById("b").removeAttribute("style");}}function an(){if(document.getElementById("a").disabled!="true"){document.getElementById("a").disabled="true";document.getElementById("a").style.background="gray";document.getElementById("b").removeAttribute("disabled");document.getElementById("b").removeAttribute("style");}else{document.getElementById("b").disabled="true";document.getElementById("b").style.background="gray";document.getElementById("a").removeAttribute("disabled");document.getElementById("a").removeAttribute("style");}}</script></body>

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。