錯鉃的怭然
2018-02-07 17:36
obj.removeAttribute()什么意思?有什么作用?
就是清除之前设置所有的样式,arr.removeAttribute('style')
<input type="button" value="改变颜色" onclick="co()">
<input type="button" value="改变宽高" onclick="wd()">
<input type="button" value="隐藏内容" onclick="cn()">
<input type="button" value="显示内容" onclick="cx()">
<input type="button" value="取消设置" onclick="qv()">
</form>
<script>
var arr=document.getElementById("txt");
function co() {
arr.style.color='red';
arr.style.backgroundColor='blue';
}
function wd() {
arr.style.width="500px";
arr.style.height="800px";
}
function cn() {
arr.style.display='none';
}
function cx() {
arr.style.display='block';
}
function qv() {
var open=confirm("是否取消设置?")
if(open==true){
arr.removeAttribute('style')
}
}JavaScript入门篇
741593 学习 · 9869 问题
相似问题
回答 2
回答 4
回答 3
回答 1
回答 1