document.getElementById("p2").className="two";==p1.className="two";
2015-09-11
function ss(){
var con = window.confirm("是否確認打開?");
if (con ==true) {
var pro = window.prompt("請輸入網址", "http://lol.qq.com");
if (pro == null) {
return null;
}else{
window.open(pro,'_blank','width=300,height=300');
}
}else{
return null;
}
}
var con = window.confirm("是否確認打開?");
if (con ==true) {
var pro = window.prompt("請輸入網址", "http://lol.qq.com");
if (pro == null) {
return null;
}else{
window.open(pro,'_blank','width=300,height=300');
}
}else{
return null;
}
}
getElementById()是根據id屬性找到對應的元素,但是它得到的是整個元素,如果你想得到元素里面的東西就要繼續添加,比如:var a=document.getElementById("con").innerHTML;
document.write(a);
document.write(a);
2015-09-10
function openWindow(){
//新窗口打開時彈出確認框是否打開
if(confirm("確定打開確認框?")==true){
//通過輸入對話框確定打開的網址默認為 http://www.xianlaiwan.cn/
var url = prompt("確定你打開的地址:","http://www.xianlaiwan.cn");
//打開的窗口要求寬400像素高500像素無菜單欄無工具欄
window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
} }
//新窗口打開時彈出確認框是否打開
if(confirm("確定打開確認框?")==true){
//通過輸入對話框確定打開的網址默認為 http://www.xianlaiwan.cn/
var url = prompt("確定你打開的地址:","http://www.xianlaiwan.cn");
//打開的窗口要求寬400像素高500像素無菜單欄無工具欄
window.open(url,'_blank','width=400,height=500,menubar=no,toolbar=no');
} }