已采纳回答 / Perona
花括号嵌套错乱了。<...code...>这里变量ope是不需要加引号的。后面的参数直接用一对单引号就可以了。修改后的代码你看看<...code...>
2015-08-02
<script type="text/javascript">
function add(){
var p1 = document.getElementById("p1");
document.write("one"+p1.className+"<br>");}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";}
</script>
function add(){
var p1 = document.getElementById("p1");
document.write("one"+p1.className+"<br>");}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";}
</script>
2015-08-02
<script type="text/javascript">
function hidetext(){
var mychar = document.getElementById("con");
mychar.style.display=none;}
function showtext()
{var mychar = document.getElementById("con");
mychar.style.display:block;}
</scrip>
function hidetext(){
var mychar = document.getElementById("con");
mychar.style.display=none;}
function showtext()
{var mychar = document.getElementById("con");
mychar.style.display:block;}
</scrip>
2015-08-02
<script type="text/javascript">
var mychar=document.getElementById("con");
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML="Hello world!";
document.write("修改后的标题:"+mychar.innerHTML); //输出修改后h2标签内容
</script>
var mychar=document.getElementById("con");
document.write("原标题:"+mychar.innerHTML+"<br>"); //输出原h2标签内容
mychar.innerHTML="Hello world!";
document.write("修改后的标题:"+mychar.innerHTML); //输出修改后h2标签内容
</script>
2015-08-02
<script type="text/javascript">
function openWindow(){
var open=confirm("确认打开新窗口吗?")
if(open=true)
{window.open('http://www.imooc.com/','_blank','width=400,height=500,menubar=no,toolbar=no');}
else{mywin.close();}
}
function openWindow(){
var open=confirm("确认打开新窗口吗?")
if(open=true)
{window.open('http://www.imooc.com/','_blank','width=400,height=500,menubar=no,toolbar=no');}
else{mywin.close();}
}
function openWindow()
var open=confirm("确认打开新窗口吗?")
if(open=true)
{ window.open('http://www.imooc.com/','_blank','width=400,height=500,menubar=no,toolbar=no')}
else{mywin.close();}
var open=confirm("确认打开新窗口吗?")
if(open=true)
{ window.open('http://www.imooc.com/','_blank','width=400,height=500,menubar=no,toolbar=no')}
else{mywin.close();}
已采纳回答 / Perona
<...code...>这里缺了引号<...code...><...code...>这里多了分号,if()后面是不需要加分号的<...code...>参考代码<...code...>
2015-08-01