<script type="text/javascript">
var mychar=document.getElementById('con');
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
</script>
var mychar=document.getElementById('con');
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
</script>
2015-05-31
function openWindow(){
var openWindow;
var openWindow=confirm("是否打開網站");
if(openWindow==true)
{
var a=prompt("請輸入打開的網站","http://www.xianlaiwan.cn")
window.open('a','_blank','width=400,height=500,menubar=no,toolbar=no,top=100')
}
else
{
alert("已取消");
}
}
var openWindow;
var openWindow=confirm("是否打開網站");
if(openWindow==true)
{
var a=prompt("請輸入打開的網站","http://www.xianlaiwan.cn")
window.open('a','_blank','width=400,height=500,menubar=no,toolbar=no,top=100')
}
else
{
alert("已取消");
}
}
var mywin=window.open("http://www.xianlaiwan.cn").close();
2015-05-31
控制類名(className 屬性)
className 屬性設置或返回元素的class 屬性。
語法:
object.className = classname
className 屬性設置或返回元素的class 屬性。
語法:
object.className = classname
2015-05-29
顯示和隱藏
object.style.display="value"
value取none和block(塊狀元素)
object.style.display="value"
value取none和block(塊狀元素)
2015-05-29
改變HTML樣式:
object.style.property
object為對象名 style是固定的 prooerty為屬性名
屬性有backgroundColor width height color font font-family font-size 等等
object.style.property
object為對象名 style是固定的 prooerty為屬性名
屬性有backgroundColor width height color font font-family font-size 等等
2015-05-29
function openWindow(){
var mymessage=confirm("是否打開");
if(mymessage==true)
{
var score;
score =prompt("輸入你的網址","http://www.xianlaiwan.cn");
if(score!=null)
{
window.open(score,'_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')
}
else
{
var mymessage=confirm("是否打開");
if(mymessage==true)
{
var score;
score =prompt("輸入你的網址","http://www.xianlaiwan.cn");
if(score!=null)
{
window.open(score,'_blank','width=400,height=500,menubar=no,toolbar=no, status=no,scrollbars=yes')
}
else
{
javaScript里用分號結束語句是可選的,沒有強制要求。不過用分號結束,可以在同一行寫多條語句。我覺得加分號是個好習慣啊...
2015-05-28