JavaScript document的使用

<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title></title>
    <script src="js/test.js" type="text/javascript" charset="utf-8"></script>
</head>
<body style="height: 3000px;">
<button onclick="func()">按钮</button>
<input type="text" id="in" placeholder="请留下大名" my="我的">
<script type="text/javascript">
 var jiinput = document.getElementById("in")
    console.log(jiinput.placeholder)
    console.log(jiinput.getAttribute("my"))
    function func(){
        jiinput.placeholder='sunck is a good man'
    }
</script>

</body>
</html>

猜你喜欢

转载自www.cnblogs.com/jeco-li/p/10193212.html