一、定义"改变颜色"的函数
提示:
obj.style.color
obj.style.backgroundColor
二、定义"改变宽高"的函数
提示:
obj.style.width
obj.style.height
三、定义"隐藏内容"的函数
提示:
obj.style.display="none";
四、定义"显示内容"的函数
提示:
obj.style.display="block";
五、定义"取消设置"的函数
提示:
使用confirm()确定框,来确认是否取消设置。
如是将以上所有的设置恢复原始值,否则不做操作。
提示:
obj.style.color
obj.style.backgroundColor
二、定义"改变宽高"的函数
提示:
obj.style.width
obj.style.height
三、定义"隐藏内容"的函数
提示:
obj.style.display="none";
四、定义"显示内容"的函数
提示:
obj.style.display="block";
五、定义"取消设置"的函数
提示:
使用confirm()确定框,来确认是否取消设置。
如是将以上所有的设置恢复原始值,否则不做操作。
2015-09-27
<script type="text/javascript">
function contxt(){
alert=("单击调用函数");}
function add(){
var add=3+2;
alert=(add);}
</script>
<input type="button" value="点击" onclick="contxt()"/>
<input type="button" value="3+2" onclick="add()"/>
function contxt(){
alert=("单击调用函数");}
function add(){
var add=3+2;
alert=(add);}
</script>
<input type="button" value="点击" onclick="contxt()"/>
<input type="button" value="3+2" onclick="add()"/>
2015-09-26
给标签设置ID 通过document.getElementById(id);获取ID
在用innerHTML替换html元素中的内容
注意!!!:innerHTML中注意大小写!!!
在用innerHTML替换html元素中的内容
注意!!!:innerHTML中注意大小写!!!
2015-09-26
document.getElementByid("con") 中的Byid id要小写。否则输出 结果:[object HTMLParagraphElement]
返回null值是错误的
返回null值是错误的
2015-09-26
function f(){
var s="引用JS文件!";
document.open();
document.write(s);
document.close();
}
</script>
</head>
<body onloda="f()">为什么用函数也不行
var s="引用JS文件!";
document.open();
document.write(s);
document.close();
}
</script>
</head>
<body onloda="f()">为什么用函数也不行
2015-09-24