var h2= document.getElementById('con');
var div = document.getElementById('txt');
function color(){
h2.style.color='red';
h2.style.backgroundColor='#CCC';
}
function width(){
div.style.width='288px';
div.style.height='288px';
}
var div = document.getElementById('txt');
function color(){
h2.style.color='red';
h2.style.backgroundColor='#CCC';
}
function width(){
div.style.width='288px';
div.style.height='288px';
}
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-13
function hidetext(){
var mychar = document.getElementById("con");
mychar.style.display = 'none';
}
function showtext(){
var mychar = document.getElementById("con");
mychar.style.display = 'block';
}
var mychar = document.getElementById("con");
mychar.style.display = 'none';
}
function showtext(){
var mychar = document.getElementById("con");
mychar.style.display = 'block';
}
2016-05-13
一開始看到p1的開始標簽里頭沒有class還以為程序出bug了要自己改,原來不寫出來不等于沒有,在function add()里頭照改,點擊后的效果也一樣(灰底紅字)
2016-05-13
prompt(str1, str2);
str1: 要顯示在消息對話框中的文本,不可修改
str2:文本框中的內容,可以修改
str1: 要顯示在消息對話框中的文本,不可修改
str2:文本框中的內容,可以修改
2016-05-12
function openWindow()
{var confirmmes = confirm("是否打開慕課網?");
if(confirmmes){url = prompt("請輸入網址","http://www.xianlaiwan.cn");
if(url=="http://www.xianlaiwan.cn"){
window.open(url,"_blank","width=400,height=500,menubar=no,toolbar=no");
}else{ alert("對不起,你輸入的網址錯誤?。?!");
}
}else{alert ("你取消了操作!?。?amp;quot;);
}}
{var confirmmes = confirm("是否打開慕課網?");
if(confirmmes){url = prompt("請輸入網址","http://www.xianlaiwan.cn");
if(url=="http://www.xianlaiwan.cn"){
window.open(url,"_blank","width=400,height=500,menubar=no,toolbar=no");
}else{ alert("對不起,你輸入的網址錯誤?。?!");
}
}else{alert ("你取消了操作!?。?amp;quot;);
}}
<script type="text/javascript">
var mywin=confirm("是否打開新網頁")
if(mywin==true)
{window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')}
else{window.close()}
</script>
var mywin=confirm("是否打開新網頁")
if(mywin==true)
{window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no')}
else{window.close()}
</script>