<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color = "red";
mychar.style.backgroundColor = "#CCC";
mychar.style.width = "300px";
</script>
var mychar= document.getElementById("con");
mychar.style.color = "red";
mychar.style.backgroundColor = "#CCC";
mychar.style.width = "300px";
</script>
2015-07-10
var mychar= document.getElementById("con");
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML = "Hello World!";
document.write("修改后的标题:"+mychar.innerHTML); //输出修改后h2标签内容
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML = "Hello World!";
document.write("修改后的标题:"+mychar.innerHTML); //输出修改后h2标签内容
2015-07-10
//定义"取消设置"的函数
function canle(){
if(confirm("是否取消设置")){
var canleALL = document.getElementById("txt");
canleALL.style.color="#000";
canleALL.style.backgroundColor="#fff";
canleALL.style.width="600px";
canleALL.style.height="400px";
canleALL.style.display="block";
}
}
function canle(){
if(confirm("是否取消设置")){
var canleALL = document.getElementById("txt");
canleALL.style.color="#000";
canleALL.style.backgroundColor="#fff";
canleALL.style.width="600px";
canleALL.style.height="400px";
canleALL.style.display="block";
}
}
记得以前看书用的是<script language="javascript"></script>
刚才查了下 好像说这种已经废弃了
现在常用的是type="text/javascript"
刚才查了下 好像说这种已经废弃了
现在常用的是type="text/javascript"
2015-07-09
function openWindow(){
var mywin;
mywin=confirm("是否打开网站");
if(mywin){
window.open('http://www.imooc.com/','blank','width=400,height=500,menubar=no,toolbar=no');
}
else{}
}
var mywin;
mywin=confirm("是否打开网站");
if(mywin){
window.open('http://www.imooc.com/','blank','width=400,height=500,menubar=no,toolbar=no');
}
else{}
}
已采纳回答 / Perona
<...code...>=是赋值的意思,==才是等于,改过来<...code...><...code...>这里缺了{,括号是成对出现的。最后也别忘了加上}修改后的JS代码<...code...>
2015-07-08
已采纳回答 / Y_du
<...code...>二个错误: 1. if(message == ture) ture没有被定义; 2. else 前后没有“}”与“{”测试可用代码如上
2015-07-08