サマリー:<!DOCTYPE html><html><head> <title>js控制div</title> <style type="text/css"> #box{width:150px;height:150px;background:#ccc;text-align:center;margin:20px 65p
<!DOCTYPE html>
<html>
<head>
<title>js控制div</title>
<style type="text/css">
#box{width:150px;height:150px;background:#ccc;text-align:center;margin:20px 65px}
</style>
</head>
<body>
<div id="box"></div>
<input type="button" value="變高" onclick="zg()">
<input type="button" value="變寬" onclick="zk()">
<input type="button" value="變色" onclick="bs()">
<input type="button" value="變圓角" onclick="byj()">
<input type="button" value="重置" onclick="cz()">
<input type="button" value="隱藏" onclick="yc()">
<input type="button" value="顯示" onclick="xs()">
<input type="button" value="寫入" onclick="xr()">
<input type="button" value="換圖" onmouseover="ys()">
<input type="hidden" id="imgsrc">
<script type="text/javascript">
var box
window.onload=function (){
box=document.getElementById("box")
}
function zg(){
box.style.height="300px"
}
function zk(){
box.style.width="300px"
}
function bs(){
box.style.background="red"
}
function cz(){
box.style.width="150px"
box.style.height="150px"
box.style.background="#ccc"
box.style.borderRadius="0px"
box.innerHTML=""
}
function yc(){
box.style.display="none"
}
function xs(){
box.style.display="block"
}
function byj(){
box.style.borderRadius="50px"
}
function xr(){
box.innerHTML="<img id='image'src='images/timg.jpg' onmouseover='overs()' onmouseleave='leaves()'/>"
box.style.textAlign="center"
box.style.lineHeight="150px"
}
function ys(){
document.getElementById('image').src="images/1.jpg"
}
function overs(){
document.getElementById('imgsrc').value = document.getElementById('image').src;
document.getElementById('image').src = 'images/timg.jpg';
}
// 鼠標移出img
function leaves(){
document.getElementById('image').src = document.getElementById('imgsrc').value;
}
</script>
</script>
</body>
</html>
經(jīng)過老師指導(dǎo)才知道鼠標移上元素和移出元素可以這樣用,謝謝勒,下一步就是多多練習(xí)剩余的獲取方式,主要是單詞記不住,老容易忘記需要查書冊,問老師,我感覺還是不熟練
添削の先生:韋小寶添削時間:2019-02-21 17:29:26
先生のまとめ:單詞記不住很正常 哪有能把所有單詞都記住的呢 要知道怎么去查就可以了