function openWindow(){
var aa= confirm("確定打開新窗口嗎");
if(aa=true){
var bb=prompt("打開下面網址","http://www.xianlaiwan.cn/");
if(bb!=null){
window.open(bb,'_blank','toolbar=no,menubar=no','width=400px,height=500px');
}
}
}
var aa= confirm("確定打開新窗口嗎");
if(aa=true){
var bb=prompt("打開下面網址","http://www.xianlaiwan.cn/");
if(bb!=null){
window.open(bb,'_blank','toolbar=no,menubar=no','width=400px,height=500px');
}
}
}
<script type="text/javascript">
var score =80; //score變量存儲成績,初值為80
if(score>=60); //score>=60是判斷條件
{
document.write("很棒,成績及格了。");
}
else //否則不及格
{
document.write("加油,成績不及格。");
}
</script>
var score =80; //score變量存儲成績,初值為80
if(score>=60); //score>=60是判斷條件
{
document.write("很棒,成績及格了。");
}
else //否則不及格
{
document.write("加油,成績不及格。");
}
</script>
2015-12-08
function openWindow(){
var a = confirm("是否打開新窗口?");
if(a==true){
window.open('http://www.xianlaiwan.cn/','_black','wight400','height500','menubar=no','toolbar=no','status=no','scrollbars=no')
}else{
alert("打開失敗!")
}
}
var a = confirm("是否打開新窗口?");
if(a==true){
window.open('http://www.xianlaiwan.cn/','_black','wight400','height500','menubar=no','toolbar=no','status=no','scrollbars=no')
}else{
alert("打開失敗!")
}
}
<script type="text/javascript">
fuction rec(){
var mymessage=confirm("你是女士嗎?");
if(mymessage==true){
document.write("你是女士");
}
else{
document.write("你是男士");
}
}
</script>
<input type="button" name="button" value="點擊" onlick="rec()">
練習一遍
fuction rec(){
var mymessage=confirm("你是女士嗎?");
if(mymessage==true){
document.write("你是女士");
}
else{
document.write("你是男士");
}
}
</script>
<input type="button" name="button" value="點擊" onlick="rec()">
練習一遍
2015-12-07
str:在消息對話框中要顯示的文本
返回值: Boolean值
當用戶點擊"確定"按鈕時,返回true
當用戶點擊"取消"按鈕時,返回false
返回值: Boolean值
當用戶點擊"確定"按鈕時,返回true
當用戶點擊"取消"按鈕時,返回false
2015-12-07