//定義"取消設置"的函數
function qx()
{ var e=confirm("是否取消設置?");
if(e==true)
{var f=document.getElementById('txt');
f.style.color="#000";
f.style.backgroundColor="#fff";
f.style.width="600px";
f.style.height="400px";
f.style.display="block";
}
else{}
}
function qx()
{ var e=confirm("是否取消設置?");
if(e==true)
{var f=document.getElementById('txt');
f.style.color="#000";
f.style.backgroundColor="#fff";
f.style.width="600px";
f.style.height="400px";
f.style.display="block";
}
else{}
}
function add(){
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
var p1 = document.getElementById("p1");
p1.className="one";
}
function modify(){
var p2 = document.getElementById("p2");
p2.className="two";
}
2016-05-06
function openWindow()
{
var mystr=confirm("是否打開新窗口?");
if(mystr==true)
{
prompt("確定打開的網址為?","http://www.xianlaiwan.cn");
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no")
}
else{
}
}
{
var mystr=confirm("是否打開新窗口?");
if(mystr==true)
{
prompt("確定打開的網址為?","http://www.xianlaiwan.cn");
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no")
}
else{
}
}
var a = confirm("你是煞筆嗎");
if(a==true){
document.write("你很誠實!");
}else{
document.write("你很聰明!");
}
if(a==true){
document.write("你很誠實!");
}else{
document.write("你很聰明!");
}
2016-05-06
function openWindow(){
var zzz=prompt("http://www.xianlaiwan.cn/","請輸入網址")
if(zzz!=null)
{
window.open(zzz,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
window.close();
}
}
var zzz=prompt("http://www.xianlaiwan.cn/","請輸入網址")
if(zzz!=null)
{
window.open(zzz,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
window.close();
}
}
function openWindow(){
var mywindow=confirm("是否打開新的窗口?")
// 新窗口彈出確認框,是否打開
if(mywindow=ture)
// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
window.open('http://www.xianlaiwan.cn','_blank,width=400,height=500,menubar=0,status=0');
}
var mywindow=confirm("是否打開新的窗口?")
// 新窗口彈出確認框,是否打開
if(mywindow=ture)
// 通過輸入對話框,確定打開的網址,默認為 http://www.xianlaiwan.cn/
//打開的窗口要求,寬400像素,高500像素,無菜單欄、無工具欄。
window.open('http://www.xianlaiwan.cn','_blank,width=400,height=500,menubar=0,status=0');
}
function openWindow(){
var open=confirm("是否打開新窗口");
if(open="ture");
{prompt("請輸入正確的網址","http://www.xianlaiwan.cn");
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no");}
else
{}
}
var open=confirm("是否打開新窗口");
if(open="ture");
{prompt("請輸入正確的網址","http://www.xianlaiwan.cn");
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no");}
else
{}
}
function rec(){
var mymessage=confirm("是女嗎?") ;
var mymess2=confirm("你好嗎?")
if(mymessage==true)
{
document.write("你是女士!");
}
else
{
document.write("你是男士!");
}
if(mymess2==true)
{ document.write("hao!");}
else{document.write("no");}
}
var mymessage=confirm("是女嗎?") ;
var mymess2=confirm("你好嗎?")
if(mymessage==true)
{
document.write("你是女士!");
}
else
{
document.write("你是男士!");
}
if(mymess2==true)
{ document.write("hao!");}
else{document.write("no");}
}
2016-05-05
在寫JS代碼輸出空格:
1. 使用輸出html標簽 來解決
document.write("  "+"1"+"    "+"23");
結果: 1 23
2. 使用CSS樣式來解決
document.write("<span style='white-space:pre;'>"+" 1 2 3 "+"</span>");
結果: 1 2 3
在輸出時添加“white-space:pre;”樣式屬性。這個樣式表示"空白會被瀏覽器保留"
1. 使用輸出html標簽&nbsp;來解決
document.write("&nbsp;&nbsp;"+"1"+"&nbsp;&nbsp;&nbsp;&nbsp;"+"23");
結果: 1 23
2. 使用CSS樣式來解決
document.write("<span style='white-space:pre;'>"+" 1 2 3 "+"</span>");
結果: 1 2 3
在輸出時添加“white-space:pre;”樣式屬性。這個樣式表示"空白會被瀏覽器保留"
2016-05-05