document.getelementById(id名称).属性.属性类型
1.<div id=“uu”>1111111<b>222</b></div>
document.getelementById(“uu”).innerHTML
2.<img src=“1.gif” id=“uu”>
document.getelementById(“uu”).src
例子;:
function subs(m){
document.getElementById("aa").src=m;
}
<img src="01.jpg" id="aa" width="100" height="160"/>
<select οnchange="subs(this.value)">
<option value="01.jpg">麦迪</option>
<option value="02.jpg">邓肯</option>
<option value="03.jpg">科比</option>
<option value="04.jpg">詹姆斯</option>
</select>
3.<div id=“uu” style="bground:red">
document.getelementById(“uu”). Style. bground
例子:
function subs1(m){
document.getElementById("ss").style.background=m;
}
<div id="ss" style="height: 100px;width: 200px; background: blue;">改变颜色</div>
<select οnchange="subs1(this.value)">
<option value="red">红色</option>
<option value="yellow">黄色</option>
<option value="pink">粉红色</option>
<option value="blue">蓝色</option>
</select>