码迷,mamicode.com
首页 > Web开发 > 详细

js获取自定义属性值

时间:2015-08-12 18:34:07      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

 

<script>
var testEle = document.getElementById("test");   
testEle.setAttribute("demo");   
</script>

<a href="#" id="test" demo="1" onclick="alert(this.attributes[‘demo‘].nodeValue)">(1)有</a>

<a href="#" id="test" demo="2" onclick="alert(this.attributes[‘demo‘].nodeValue)">(2)无</a>

 

js获取自定义属性值

标签:

原文地址:http://www.cnblogs.com/baixc/p/4724867.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!