JAVA
Script重點介紹
<html><head>…..<title>…..</title></head><body>…..</body></html>網頁設計架構
<html>…..</html> 網頁的開始及結束都必需有
<head>…..</head> 定義網頁的標籤
<title>標題</title> 標題列顯示的文字
<body>…..</body> 網頁的主要內容
<script language=javascript>…..</script> 編寫javascript語言的範圍
window.alert(“\n歡迎光臨\n這是我的個人網頁”); 顯示對話盒
<!--…..//--> 當作是HTML的註解
today=new date() 今天的日期放入變數
today.getyear(),getmonth(),getdate 取得日期變數中的年,月,日
gethours(),getminutes(),getseconds(),getday() 取得時間變數中的時,分,秒,星期幾
var string1=”happy” 宣告變數名為string1放字串”happy”
function showclock(x){x=x*x………return (x).} 自定函數,通常寫在<head>…</head>之間
settimeout(“showclock()”,1000); 設定每秒執行此函數一次
<body onload=”showclock()”> 載入此網頁時執行showclock()函數
document.clock.time.value=”現在時間” 資料放入文件的clock表單的time文字框的value值
if (hour<=9) {hour=”0”+hour} else if (…..) {…..} 也可只用else但不加條件,同一行可不加{}
<form name=”clock”><input type=”text” name=”time” size=20></form> 設表單及文字框
document.write(“大家好”) 顯示訊息
document.write(“<center><img height=400 width=200 src=’day.gif’>”)顯示圖片
document.bgColor=”white”,document.fgColor=”black” 設背景白色,前景文字黑色,C要大寫
document.lastModified 此網頁的最後修改日期
screen.width,screen.height 螢幕的寬度及高度
location=”test.htm” 顯示test.htm網頁
function reload(){location=”test.htm”} settimeout(“reload()”,5000); 五秒後執行test.htm網頁
<a href=”javascript:window.external.addfavorite(‘http://www.mcsh.kh.edu.tw’,’明誠)> 我的最愛
name=window.open(“URL”,”視窗名稱”,”參數”) 開啟名為name的視窗並載入URL網址
“toolbar=no,location=no,status=no,menubar=no,width=200,height=150” 無工具列,不指定視窗位置,無狀態列,功能表列,寬度200,高度150
settimeout(“self.close();”,5000) 五秒鐘內關閉此視窗
<body onunload=”goodbye()”> 離開網頁時開啟goodbye函式
window.status=”狀態列顯示字串” 在視窗的狀態列顯示訊息
text.substring(開始位置,字串長度); 顯示某一長度之字串
while(條件){…..} 條件成立時執行工作
+加,-減,*乘,/除,%取餘數,++加1,--減1,-負號
==等於,!=不等於,>大於,>=大於等於,&&且,||或
student=new array(50) 建立名為student的陣列,內可放50個元素
變色表格列<TR bgcolor="#DAFFDA" onMouseOver="this.style.backgroundColor='#FFCC99'" onMouseOut="this.style.backgroundColor=''" >