最赞回答 / 木头锤纸
- -刚才问了下老师,我还是自问自答吧,通过getElementsByTagName("h2")获取的是所有的h2标签元素,因而赋值给变量mychar的是一个包含所有h2标签元素的数组(即便这个数组只有一个h2标签元素,也是一个数组),如果想正常显示的话应该选取变量mychar的第一个值,即将第12行代码改为document.write("原标题:"+mychar[0].innerHTML+"<br>");
2015-07-29
var idVal=document.getElementById("txt");
function Display2(){
idVal.style.display="block";
}
function Cancel(){
var idVal =confirm("确定取消吗?");
if(idVal==true){
idVal.setAttribute('style');
document.write("已经取消所有操作");
else{
document.write("什么也没干");
}
function Display2(){
idVal.style.display="block";
}
function Cancel(){
var idVal =confirm("确定取消吗?");
if(idVal==true){
idVal.setAttribute('style');
document.write("已经取消所有操作");
else{
document.write("什么也没干");
}
最新回答 / WINJAYZENG
<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" Content="text/html; charset=utf-8" /><title>javascript</title><style type="text/css">body{font-size:12px;}#txt{ height:400px; width:600px; border:#3...
2015-07-29
已采纳回答 / fluent
这逻辑就不对,window.open()在mycc为true的分支里,说明只要是打开就会弹出http://www.imooc.com/网址,你需要在写一个分支,来判断address的值,咋确定是否打开新的窗口或者,网址是不是为空,或者是否点击了prompt中的取消键,希望帮到你。
2015-07-29
<script type="text/javascript">
function Wopen(){
var mywin=confirm("是否打开");
if(mywin==true)
{ window.open('http://www.imooc.com','_blank','height=500,width=400,top=100,left=0');
}
else
{ mywin.close();
}
}
</script>
function Wopen(){
var mywin=confirm("是否打开");
if(mywin==true)
{ window.open('http://www.imooc.com','_blank','height=500,width=400,top=100,left=0');
}
else
{ mywin.close();
}
}
</script>