欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

JS getAttribute和setAttribute(取得和設(shè)置屬性)的使用介紹

 更新時(shí)間:2013年07月10日 12:10:19   作者:  
本篇文章是對(duì)JS中的getAttribute和setAttribute(取得和設(shè)置屬性)的使用進(jìn)行了詳細(xì)的分析介紹,需要的朋友可以參考下

getAttribute:取得屬性;
setAttribute:設(shè)置屬性;

復(fù)制代碼 代碼如下:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <title>Untitled Document</title>
        <script language="JavaScript">
            function change() {
                var input = document.getElementById("li1");
                alert(input.getAttribute("title"));
                input.setAttribute("title", "mgc");
                alert(input.getAttribute("title"));
            }
        </script>
    </head>
    <body>
        <ul id="u">
            <li id="li1" title="hello">Magci</li>
            <li>J2EE</li>
            <li>Haha!</li>
        </ul>
        <input type="button" value="Change" onClick="change();" />
    </body>
</html>

相關(guān)文章

最新評(píng)論