var mychar= document.getElementById("con"); 这一句只是获取了id为con的这个元素,并没有获取元素中的内容 给后面加上.text()
.html() .innerHTML()都可以
.html() .innerHTML()都可以
2016-01-27
function openWindow(){
var value=confirm("是否确认打开新窗口");
if(value==true){
var url=prompt("请输入网址:","http://www.imooc.com");
if(url!=null){
window.open("url","_blank","width:400px,height:500px,menubar:no,toolbar:no");
}else{
alert("请关闭");
}
}else{
alert("请关闭");
};
var value=confirm("是否确认打开新窗口");
if(value==true){
var url=prompt("请输入网址:","http://www.imooc.com");
if(url!=null){
window.open("url","_blank","width:400px,height:500px,menubar:no,toolbar:no");
}else{
alert("请关闭");
}
}else{
alert("请关闭");
};
最赞回答 / lprainbow
<!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:600p...
2016-01-26
function openWindow()
{ var a=confirm("确定打开?");
if(a==true){
var b=prompt("输入网址","http://www.imooc.co")
if(b=="http://www.imooc.co")
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolar=no');
}
}
}
{ var a=confirm("确定打开?");
if(a==true){
var b=prompt("输入网址","http://www.imooc.co")
if(b=="http://www.imooc.co")
{window.open('http://www.imooc.com','_blank','width=400,height=500,menubar=no,toolar=no');
}
}
}
function openWindow(){
var open=confirm("open/No");
if(open){
var httpWindow=prompt("please input http:", "http://www.imooc.com");
if(httpWindow){
window.open(httpWindow,"_blank","width=400px,height=500px,menubar=no,tolbar=no");
}
}
}
var open=confirm("open/No");
if(open){
var httpWindow=prompt("please input http:", "http://www.imooc.com");
if(httpWindow){
window.open(httpWindow,"_blank","width=400px,height=500px,menubar=no,tolbar=no");
}
}
}