confirm("答案是是或者否的一个问题");
选择是则结果为true,否则结果为false
选择是则结果为true,否则结果为false
2016-06-28
document.write(mychar+"<br/>");注意分号啊
2016-06-28
function openWindow(){
var isOpen=confirm("是否打开新窗口"); if(isOpen){var http=prompt("请输入要打开的网址","http://www.baidu.com");
//判断用户输入的值是否为空
if(http!=null){
//这里的网址必须加http://
window.open(http,"_blank","width=400,height=500,menubar=no,toolbar=no");
var isOpen=confirm("是否打开新窗口"); if(isOpen){var http=prompt("请输入要打开的网址","http://www.baidu.com");
//判断用户输入的值是否为空
if(http!=null){
//这里的网址必须加http://
window.open(http,"_blank","width=400,height=500,menubar=no,toolbar=no");
js貌似没法明确的获取具体的数据类型
比如
var mywin=window.open("http://www.imooc.com");这个获取的就是我打开的那个窗口
var a=1; 这个又是数值
var a=true; 布尔值
所以它的数据类型是依据于等号之后 等号之前var 只是去声明
比如
var mywin=window.open("http://www.imooc.com");这个获取的就是我打开的那个窗口
var a=1; 这个又是数值
var a=true; 布尔值
所以它的数据类型是依据于等号之后 等号之前var 只是去声明
2016-06-28
function openWindow()
{
var k=confirm("是否需打开网站?");
if(k == true)
var otherurl=prompt("请输入网站:","http://www.imooc.com/");//输入对话框,默认慕课网址
if(otherurl!="")//打开相应规定网站
window.open(otherurl,"_blank","width=400,height=500,toolbar=no,menu=no");
}
{
var k=confirm("是否需打开网站?");
if(k == true)
var otherurl=prompt("请输入网站:","http://www.imooc.com/");//输入对话框,默认慕课网址
if(otherurl!="")//打开相应规定网站
window.open(otherurl,"_blank","width=400,height=500,toolbar=no,menu=no");
}
function aa(){
var mywin=window.open("http://www.imooc.com","_blank","width=600,height=400,left=0,top=50");
}
<button onclick="aa()">打开</button><br/>
<button onclick="mywin.close()">关闭</button>
var mywin=window.open("http://www.imooc.com","_blank","width=600,height=400,left=0,top=50");
}
<button onclick="aa()">打开</button><br/>
<button onclick="mywin.close()">关闭</button>
2016-06-28