javascript 作為一種腳本語言,可以放在html頁面中的任何位置,根據執行先后順序,合理地放置JavaScript的位置。
2015-07-15
html---> <script src="??,js"></script>
js ---> document.write("??????");
js ---> document.write("??????");
2015-07-15
<script type="text/javascript">
document.write("開啟JS之旅!");
</script>
document.write("開啟JS之旅!");
</script>
2015-07-15
希望在前方,努力!分號忘記寫了
document.write("hello JavaScript");
document.getElementById("p1").style.color="blue";
document.write("hello JavaScript");
document.getElementById("p1").style.color="blue";
2015-07-15
var my =prompt("請輸入要打開的網址");
if(my==""){
window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
window.open(my,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
if(my==""){
window.open('http://www.xianlaiwan.cn/','_blank','width=400,height=500,menubar=no,toolbar=no');
}
else{
window.open(my,'_blank','width=400,height=500,menubar=no,toolbar=no');
}
function dcolor(){
var mychar=document.getElementById("txt");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
}
function dwh(){
var mychar=document.getElementById("txt");
mychar.style.width="400px";
mychar.style.height="200px";
}
var mychar=document.getElementById("txt");
mychar.style.color="red";
mychar.style.backgroundColor="#ccc";
}
function dwh(){
var mychar=document.getElementById("txt");
mychar.style.width="400px";
mychar.style.height="200px";
}
function openWindow(){
var open = confirm("確認打開?");
if(open==true){
var add=prompt("網址:","http://www.xianlaiwan.cn/");
if(add=="http://www.xianlaiwan.cn/"){
window.open(add,'_blank','width=400,height=500,menubar=no,toobar=no');
}
}
}
var open = confirm("確認打開?");
if(open==true){
var add=prompt("網址:","http://www.xianlaiwan.cn/");
if(add=="http://www.xianlaiwan.cn/"){
window.open(add,'_blank','width=400,height=500,menubar=no,toobar=no');
}
}
}