<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>插入js代碼</title>
<script type="text/javascript">
document.write("開啟JS之旅!");
</script>
</head>
<body>
</body>
</html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>插入js代碼</title>
<script type="text/javascript">
document.write("開啟JS之旅!");
</script>
</head>
<body>
</body>
</html>
2016-04-10
document.write("hello");
document.getElementById("p1").style.color="blue";
document.getElementById("p1").style.color="blue";
2016-04-10
function openWindow(){
var isOpen=confirm("是否打開慕課網?")
if(isOpen){
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no")
}
}
注意openWindow函數名中W要大寫,同onclick中函數名保持一致
var isOpen=confirm("是否打開慕課網?")
if(isOpen){
window.open("http://www.xianlaiwan.cn","_blank","width=400,height=500,menubar=no,toolbar=no")
}
}
注意openWindow函數名中W要大寫,同onclick中函數名保持一致
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>插入js代碼</title>
<script>
document.write("開啟JS之旅!");
</script>
</head>
<meta http-equiv="Content-Type" content="text/html; charset=gb18030">
<title>插入js代碼</title>
<script>
document.write("開啟JS之旅!");
</script>
</head>
2016-04-10
輸出多項內容時要記得使用+進行連接,也可以輸出HTML標簽,如果要讓標簽起作用的話,要使用“”括起來
2016-04-10
if else語句是指條件成立時執行IF后面的代碼,否則執行else后面的代碼。還有就是JS代碼一般放在head標簽里面
2016-04-10