這個有bug,如果你在提問框里面輸入非數值,比如字符或者為空,還是會彈出“要努力”。
在開頭這樣寫:score =prompt("輸入你的成績","0-100的數字");
然后在這里加上這樣的判斷: else if(score<60&&score>=0)
{
document.write("要努力了!");
}
else{
document.write("請輸入正確成績值")
}
}
這樣會更完善!
在開頭這樣寫:score =prompt("輸入你的成績","0-100的數字");
然后在這里加上這樣的判斷: else if(score<60&&score>=0)
{
document.write("要努力了!");
}
else{
document.write("請輸入正確成績值")
}
}
這樣會更完善!
2016-05-05
function openWindow()
{ var open = confirm("是否打開新窗口?")
if(open ==true)
{
window.open('http://www.xianlaiwan.cn','_black','width=400,height=500,menubar=no,toolbar=no');
else {}
}
{ var open = confirm("是否打開新窗口?")
if(open ==true)
{
window.open('http://www.xianlaiwan.cn','_black','width=400,height=500,menubar=no,toolbar=no');
else {}
}
function Wopen(){
var chose = confirm("是否要打開新窗口");
if (chose) {
var net = prompt("請輸入網址","http://www.xianlaiwan.cn/");
window.open(net,"_blank","width = 400, heigth = 500");
} else{
alert("不允許打開新的窗口");
}
}
var chose = confirm("是否要打開新窗口");
if (chose) {
var net = prompt("請輸入網址","http://www.xianlaiwan.cn/");
window.open(net,"_blank","width = 400, heigth = 500");
} else{
alert("不允許打開新的窗口");
}
}
2016-05-04
function openWindow(){
var con = confirm("是否打開");
if(con ==true){
var pro = prompt("確定打開的網址","http://www.xianlaiwan.cn");
if(pro==null){
}else{
window.open(pro,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}else{};
}
var con = confirm("是否打開");
if(con ==true){
var pro = prompt("確定打開的網址","http://www.xianlaiwan.cn");
if(pro==null){
}else{
window.open(pro,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
}else{};
}