attributes["wv"].nodeValue

w

获取自定义属性的值

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div class=" item-link card-content-inner" id="gname2" wv="w2">w2
</div>


<script type="text/javascript">
    wi = 2
    $$("gname" + wi).attributes["wv"].nodeValue

    console.log($$("gname" + wi).attributes["wv"].nodeValue)
    console.log($$("gname" + wi).attributes["wv"])

    console.log($$("gname" + wi))


    function $$(id) {
        return typeof id === 'string' ? document.getElementById(id) : id;
    }

</script>


</body>
</html>
</body>
</html>

 

posted @ 2017-03-04 20:26  papering  阅读(272)  评论(0编辑  收藏  举报