注意引號及位置, 騰訊瀏覽器下:
'width=600,height=400,menubar=no,toolbar=no, status=no,scrollbars=yes' √
width=600,height=400,menubar=no,toolbar=no, status=no,scrollbars='yes' √
width=600,height=400,menubar=no,toolbar=no, status=no,scrollbars=yes X
'width=600,height=400,menubar=no,toolbar=no, status=no,scrollbars=yes' √
width=600,height=400,menubar=no,toolbar=no, status=no,scrollbars='yes' √
width=600,height=400,menubar=no,toolbar=no, status=no,scrollbars=yes X
2015-06-06
<script type="text/javascript">
var p1 = document.getElementById("p1");
document.write(p1.className+"<br>")
function add(){p1.className="one"}
var p2 = document.getElementById("p2");
document.write(p2.className+"<br>")
function modify(){p2.className="two"}
</script>
var p1 = document.getElementById("p1");
document.write(p1.className+"<br>")
function add(){p1.className="one"}
var p2 = document.getElementById("p2");
document.write(p2.className+"<br>")
function modify(){p2.className="two"}
</script>
2015-06-05
<script type="text/javascript">
function opennew(){
var qrdk=confirm("是否打開新網站窗口")
if(qrdk==true){ var shuru=prompt("打開網址為:www.baidu.com")
window.open("http://www.baidu.com","_blank","width=400,height=600")} }
</script>
<button type="button" onClick="opennew()">點擊我輸入成績哦</button>
function opennew(){
var qrdk=confirm("是否打開新網站窗口")
if(qrdk==true){ var shuru=prompt("打開網址為:www.baidu.com")
window.open("http://www.baidu.com","_blank","width=400,height=600")} }
</script>
<button type="button" onClick="opennew()">點擊我輸入成績哦</button>
<script type="text/javascript">
var my=confirm("是否打開網頁");
if(my==true)
{
var m=prompt("打開網址","http://www.xianlaiwan.cn")}
window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no')
</script>
var my=confirm("是否打開網頁");
if(my==true)
{
var m=prompt("打開網址","http://www.xianlaiwan.cn")}
window.open('http://www.xianlaiwan.cn','_blank','width=400,height=500,menubar=no,toolbar=no')
</script>
窗口名稱:被打開窗口的名稱??梢允?amp;quot;_top"、"_blank"、"_self"等。是_self
2015-06-04
<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="grey";
mychar.style.width=300;
</script>
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="grey";
mychar.style.width=300;
</script>
2015-06-04
<script type="text/javascript">
function openWindow() {
var myurl = prompt("輸入要打開的網址", "http://www.xianlaiwan.cn")
var wantopen = confirm("確認打開" + myurl + "?");
if (wantopen) {
window.open(myurl, '_blank', 'width=400,height=500,menubar=no,toolbar=no');
}
}
</script>
function openWindow() {
var myurl = prompt("輸入要打開的網址", "http://www.xianlaiwan.cn")
var wantopen = confirm("確認打開" + myurl + "?");
if (wantopen) {
window.open(myurl, '_blank', 'width=400,height=500,menubar=no,toolbar=no');
}
}
</script>
<script type="text/javascript">
function openWindow(){
var my=confirm();
if(my==true)
{prompt("wangzhi","http://www.xianlaiwan.cn")}
window.open(prompt,'_blank','width=400,height=500,menubar=no,toolbar=no')}
</script>
</head>
function openWindow(){
var my=confirm();
if(my==true)
{prompt("wangzhi","http://www.xianlaiwan.cn")}
window.open(prompt,'_blank','width=400,height=500,menubar=no,toolbar=no')}
</script>
</head>
<script type="text/javascript">
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px"
</script>
注意大小寫
var mychar= document.getElementById("con");
mychar.style.color="red";
mychar.style.backgroundColor="#CCC";
mychar.style.width="300px"
</script>
注意大小寫
2015-06-02
<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>
2015-06-02
<script type="text/javascript">
function openWindow(){
var mama=confirm("確認跳轉");
if(mama==true){
var baba=prompt("請輸入您的網址","http://www.xianlaiwan.cn/")
window.open('http://www.xianlaiwan.cn/','_blank','width=600','height=400')
}
}
function openWindow(){
var mama=confirm("確認跳轉");
if(mama==true){
var baba=prompt("請輸入您的網址","http://www.xianlaiwan.cn/")
window.open('http://www.xianlaiwan.cn/','_blank','width=600','height=400')
}
}