本次交作業(yè), 我覺得這樣寫不錯, 可以看看。
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>style樣式</title>
</head>
<style type="text/css">
? ? .one{
? ? ? ? border: 2px solid #eee;
? ? ? ? width: 230px;
? ? ? ? height: 50px;
? ? ? ? background: #CCC;
? ? ? ? color:brown;
? ? }
</style>
<script type="text/javascript">
? ?function fun1(){
? ? var i = document.getElementById("con");
? ? ? ? i.className = "one";
? ?}
? ?function fun2(){
? ? ? ?var i = document.getElementById("con");
? ? ? ? i.style.display="block";
? ?}
? ?function fun3(){
? ? ? ?var i = document.getElementById("con");
? ? ? ?i.style.display="none";
? ?}
? ?function fun4(){
? ? ? ?var i = document.getElementById("con");
? ? ? ?i.className = "";
? ?}
? </script>
<body>
? <h2 id="con">I love JavaScript</H2>
? <p> JavaScript使網(wǎng)頁顯示動態(tài)效果并實(shí)現(xiàn)與用戶交互功能。</p>
? <form>
? ? ? <input type="button" value="換色" onclick="fun1()">
? ? ? <input type="button" value="還原" onclick="fun4()">
? ? ? <input type="button" value="顯示" onclick="fun2()">
? ? ? <input type="button" value="隱藏" onclick="fun3()">
? </form>
??
??
</body>
</html>
2020-08-14
2020-08-14
這個方法不錯, 學(xué)習(xí)了