function openWindow(){
if(confirm("是否打開新窗口?")){
var url=prompt("請輸入網址:","http://www.xianlaiwan.cn/");
window.open('url','_blank','width=400, height=500,menubar=no, toolbar=no');
}
}
if(confirm("是否打開新窗口?")){
var url=prompt("請輸入網址:","http://www.xianlaiwan.cn/");
window.open('url','_blank','width=400, height=500,menubar=no, toolbar=no');
}
}
<p id="p1">我是第一段文字</p>
<p id="p2">我是第二段文字</p>
<script type="text/javascript">
document.write("hello");
document.getElementById("p1").style.color="blue";
<p id="p2">我是第二段文字</p>
<script type="text/javascript">
document.write("hello");
document.getElementById("p1").style.color="blue";
2016-03-17
document.write("hello");
document.getElementById("p1").style.color="blue";
document.getElementById("p1").style.color="blue";
2016-03-17
<script type="text/javascript">
var mychar=document.getElementById("con"); ;
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
mychar.innerHTML="Hello,world!";
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
</script>
var mychar=document.getElementById("con"); ;
document.write("原標題:"+mychar.innerHTML+"<br>"); //輸出原h2標簽內容
mychar.innerHTML="Hello,world!";
document.write("修改后的標題:"+mychar.innerHTML); //輸出修改后h2標簽內容
</script>
2016-03-17
<title>瀏覽器對象</title>
<script type="text/javascript">
function openWindon(){
if(confirm("確定打開新窗口嗎?")){
var url = prompt("請輸入一個網址","http://www.xianlaiwan.cn/");
window.open( url,"_blank","toolbar=no, menubar=no, scrollbars=yes, width=400, height=400");
}
}
</script>
<script type="text/javascript">
function openWindon(){
if(confirm("確定打開新窗口嗎?")){
var url = prompt("請輸入一個網址","http://www.xianlaiwan.cn/");
window.open( url,"_blank","toolbar=no, menubar=no, scrollbars=yes, width=400, height=400");
}
}
</script>
getElenmentById 獲取的不是id為con的 文本內容。輸出對面本身 而他輸出的結果為 :null或[object HTMLParagraphElement] 我把id為 con 改為 con1. 他獲取不到id 。輸出就是 null
2016-03-17