首页 > Web开发 > 详细

js setAttribute removeAttribute

时间:2014-05-09 04:16:20      阅读:413      评论:0      收藏:0      [点我收藏+]

 

bubuko.com,布布扣
 1     <input type="button" value="生效" style="font-size:111px"/>
 2     <script type="text/javascript">
 3             //单击"生效"按钮,将其失效
 4         var buttonElement=document.getElementsByTagName("input")[0];
 5         buttonElement.onclick=function(){
 6             //添加属性 
 7             this.setAttribute("disabled","true");
 8             //修改属性
 9             this.setAttribute("style","font-size:10px");
10             //删除属性
11             this.removeAttribute("disabled");
12             //另一种修改方式  有些浏览器可能不知道
13             this.value="狗狗狗狗";
14         }
15     </script>
bubuko.com,布布扣

 

js setAttribute removeAttribute,布布扣,bubuko.com

js setAttribute removeAttribute

原文:http://www.cnblogs.com/friends-wf/p/3716288.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!