<!-- 語系設定 start-->
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
Session.CodePage=65001 ' UTF-8
Session.CodePage = 950 ' BIG5
Session.CodePage = 936 ' GB2312
Response.CharSet="BIG5"
Response.CharSet="GB2312"
%>
<!-- 語系設定 end-->
<!-- 轉址用 start-->
<meta http-equiv="Refresh" content="0; URL=xxx.asp">
<!-- 轉址用 end-->
<!-- 匯入檔案用 start-->
<!--#include virtual="/include/xxx.inc" -->
<script language="javaScript" type="text/javascript" src="http://jakei01.netfirms.com//images/board.js"></script>
<script language=vbscript src="loading.js"></script>
<!-- 匯入檔案用 end-->
<!-- 清空文字方框中之字串 start-->
<input name="test" size="18" value="輸入關鍵字" onFocus="if (this.value=='輸入關鍵字') {this.value=''}" onBlur="if(this.value=='')this.value='輸入關鍵字'">
<!-- 清空文字方框中之字串 end-->
<!-- 一般文件用 start-->
<html>
<head>
<title></title>
<!-- meta http-equiv="Content-Type" content="text/html; charset=utf-8" -->
<meta http-equiv="content-type" content="text/html; charset=big5">
<meta http-equiv="Content-Language" content="zh-tw">
<meta http-equiv="Expires" content="Mon, 1 Jan 2000 1:00:00 GMT">
<meta http-equiv="Pragma" content="nocache">
<meta http-equiv="Window-target" content="_blank">
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
</body>
</html>
<!-- 一般文件用 end-->
<!-- frame用 start-->
<!-- row為上至下方向 col為左至右方向 -->
<html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=big5">
<meta http-equiv="Expires" content="Mon, 1 Jan 2001 1:00:00 GMT">
<meta http-equiv="Pragma" content="no-cache">
</head>
<frameset rows="100,1*" cols="*" border="0" framespacing="0" frameborder="NO">
<frame src="xxx.asp" marginwidth="0" marginheight="0" frameborder="NO" scrolling="NO">
<frameset cols="200,1*" rows="*" border="0" framespacing="0" frameborder="NO">
<frame name="xxx" src="xxx.asp" marginwidth="0" marginheight="0" frameborder="NO" scrolling="NO">
<frame name="xxx" src="xxx.asp" marginwidth="0" marginheight="0" frameborder="NO">
</frameset>
</frameset>
</html>
<!-- frame用 end-->
<!-- 欄位資料檢查 start-->
<script language="JavaScript">
<!--
function CheckAll(theForm)
{
// 防止使用者重複按下Submit按鈕
theForm.Submit1.disabled=true; // 將Submit按鈕加上id="Submit1"
//檢查欄位是否為空白
if (!CheckEmpty(theForm.UserName, "名字")) return false;
if (!CheckEmail(theForm.FatherEmail)) return false;
if (!CheckNumber(theForm.Total, "總額")) return false;
if (!CheckPhoneNumber(theForm.Phone)) return false;
if (!CheckRadio(theForm,theForm.Identity, "身份")) return false;
if (!CheckSelect(theForm.City, "縣市")) return false;
if (!CheckEqual(theForm.Password,theForm.Password2, "密碼")) return false;
if (!CheckMaxLength(theForm.Address, 50, "地址")) return false;
if (!CheckMinLength(theForm.Address, 12, "地址")) return false;
//全部符合
return true;
}
function Error(Msg)
{
alert(Msg);
form1.Submit1.disabled=false;
}
String.prototype.trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
function CheckEmpty(Field, FieldTitle) //欄位資料是否空白
{
if (Field.value.trim() == "")
{
Error("『"+FieldTitle+"』欄位未填");
Field.focus();
return false;
}
return true;
}
function CheckEmail(Field) //Email檢查
{
if (Field.value != ""){
var sReg = /[_a-zA-Z\d\-\.]+@[_a-zA-Z\d\-]+(\.[_a-zA-Z\d\-]+)+$/;
if (! sReg.test(Field.value))
{
Error("Email格式錯誤,請重新輸入!");
Field.focus();
return false;
}
}
return true;
}
function CheckNumber(Field,FieldTitle) //數字檢查
{
for (var i=0; i < Field.value.length; i++)
{
var sReg = /^[\d]*$/;
if (! sReg.test(Field.value))
{
Error("『" + FieldTitle + "』限填數字");
Field.focus();
return false;
}
}
return true;
}
function CheckPhoneNumber(Field) //電話數字檢查
{
for (var i=0; i < Field.value.length; i++)
{
//var ch=Field.value.charAt(i);
//if ((ch != "(") && (ch != ")") && (ch != "-") && (ch != "0") && (ch != "1") && (ch != "2") && (ch != "3") && (ch != "4") && (ch != "5") && (ch != "6") && (ch != "7") && (ch != "8") && (ch != "9"))
var sReg = /^[\d\-\(\)]*$/;
if (! sReg.test(Field.value))
{
Error("電話只能填入『數字』、『( )』、『-』等符號,其他符號都不能填入!");
Field.focus();
return false;
}
}
return true;
}
function CheckRadio(theForm,Field,FieldTitle)
{
var sel;
for(var i=0; i<theForm.elements.length; i++)
{
var e=theForm.elements[i];
if(e.name == Field)
{
if (e.checked == true) {sel=true;}
}
}
if (sel != true)
{
Error("『" + FieldTitle + "』欄位未填");
document.getElementById(Field).focus();
return false;
}
return true;
}
function CheckSelect(Field, FieldTitle)
{
if (Field.selectedIndex == 0)
{
Error("『"+FieldTitle+"』欄位未選擇");
Field.focus();
return false;
}
return true;
}
function CheckEqual(Field,Field2,FieldTitle)
{
if (Field.value != Field2.value)
{
Error("『" + FieldTitle + "』欄位不一致");
Field.focus();
return false;
}
return true;
}
function CheckMaxLength(Field,Length,FieldTitle)
{
if (Field.value.length>parseInt(Length))
{
Error("『" + FieldTitle + "』字數長度請勿超過" + Length + "個字");
Field.focus();
return false;
}
return true;
}
function CheckMinLength(Field,Length,FieldTitle)
{
if (Field.value.length<parseInt(Length))
{
Error("『" + FieldTitle + "』字數長度不足" + Length + "個字");
Field.focus();
return false;
}
return true;
}
//-->
</script>
********************************************************************
加到 form 中
<form id="form1" runat="server" onsubmit="return CheckAll(this)">
********************************************************************
加到 Submit按鈕中
<input type="button" value="Submit" onclick="this.disabled=true;this.form1.submit()"
********************************************************************
<!-- 欄位資料檢查 end-->
<!-- 網頁中加入另一網頁 -->
<iframe marginwidth=0 marginheight=0 frameborder=0 scrolling=no width=540 height=18 name="ticker" src="http://www.ettoday.com.tw/common/ticker.htm"></iframe>
<!-- 網頁中加入另一網頁 end-->
<!-- 回上一頁 -->
<a href="javascript:history.back(1)">[上一頁]</a>
<!-- 回上一頁 end-->
<!-- 狀態列訊息 -->
<a href="#" onMouseOver="window.status='活動介紹'; return true;" onMouseOut="window.status='';">test</a>
<!-- 狀態列訊息 end-->
<!-- 斷行處理 -->
' 處理有 enter 符號,換為 <br>
body = Replace(body, vbCrlf, "<br>")
' 於執行斷行時,<br>一樣會被加一,算入是否大於 80 字元,為了不加一,所以用`字,先代替<br>
body = Replace(body, "<br>", "`")
' 斷行處理的副程式
breakline(body)
' 還原 ` 為 <br>
body = Replace(body , "`", "<br>" )
Function breakline(m_output)
'上一次位置、目前累計長度、實際位置、總長度
Dim old_pos, tmp_Len, i, tot_Len,temp_body,temp2_body
old_pos = 0 '上一次位置
tmp_Len = 0 '記錄邏輯上的長度
TOT_LEN = Len(Trim(m_output))
temp_body = ""
temp2_body = ""
' i 代表字串中實際的位置
For i = 1 To tot_Len
If Len(Hex(Asc(Mid(m_output, i, 1)))) > 2 and Mid(m_output,i,1) <> "`" Then
'將長度加2
tmp_Len = tmp_Len + 2
ElseIf Mid(m_output,i,1) = "`" then
temp_body = Mid(m_output,old_pos+1,i-old_pos)
' 還原計數值,因為 <BR> 也會被算入,所以將<BR>將換為"`",以避免被加一
old_pos = i
tmp_Len = 0
ELSE
' 否則加1
tmp_Len = tmp_Len + 1
End If
'如果大於等於 80 字元,準備輸出結果
If tmp_Len >= 80 Then
temp_body = Mid(m_output,old_pos+1,i-old_pos) & "<br>"
' 還原計數值
old_pos = i
tmp_Len = 0
End If
temp2_body = temp2_body & temp_body
temp_body = ""
Next
'將其餘的字元(如果還有的話)一併輸出
If tmp_Len > 0 Then
body = temp2_body & Mid(m_output,old_pos+1,tot_Len-old_pos)
body = Replace(body ,"`", "<br>" )
End If
End Function
<!-- 斷行處理 end-->
<!-- 圖片特效 -->
<a HREF="#" target="_blank">
<IMG style=filter:gray() onmouseover=this.style.filter="" onmouseout=this.style.filter="gray()" src="http://www.knsh.com.tw/Image9.gif">
</a>
<!-- 圖片特效 end-->
<!-- 跳頁選單01 -->
目前所在頁次為第 <font class="txt"><%=page%></font> 頁 |
總頁數有 <font class="txt"><%=rs.pagecount%></font> 頁 |
現有資料共 <font class="txt"><%=rs.recordcount%></font> 筆
<select name="jump" onChange="location.href=this.options[this.selectedIndex].value;" class="txt">
<%
FOR J=1 to rs.pagecount
IF J = cint(page) then StrSelect=" selected" else StrSelect=""
IF J < 10 then J = "0" & J
response.write " <option value=""" & SourceURL & "?Page=" & cint(J) & """" & StrSelect & ">跳到第 " & J & "頁"
NEXT
%>
</select>
<!-- 跳頁選單01 end-->
<!-- 跳頁選單02 -->
<%
page=request("page")
if len(page)=0 then page=1
rs.pagesize=10
if not rs.eof then rs.absoluteposition=((page-1)*rs.pagesize)+1
%>
<span class="no9g">
<a href=?page=1>首頁</a>
<%
dim x,y,z
y=page-5
z=page+5
if z>rs.pagecount then z=rs.pagecount
if y<=0 then y=1
for x=y to z
if Cint(x)<>Cint(page) then
response.write "<a href=?page=" & x & "><font color=""#FFFFFF"">" & x & "</font></a> "
else
response.write "<font color=""#AAAAAA"">" & x & "</font> "
end if
next
%>
<a href=?page=<%=rs.pagecount%>>末頁</a>
【第 <%=page%> 頁 / 共 <%=rs.pagecount%> 頁】
</span>
<!-- 跳頁選單02 end-->
<!-- 顯示錯誤訊息 -->
<%
' 放最前面
On Error Resume Next
%>
<%
set myerror=rs.activeconnection.errors
response.write "系統發生" & myerror.count & "個錯誤<br>"
for i=0 to myerror.count-1
response.write myerror(i).description & "<br>"
next
%>
<!-- 顯示錯誤訊息 end-->
<!-- 斷行處理 -->
style="WIDTH: 200px; WORD-WRAP: break-word"
<!-- 斷行處理 end-->
<!-- 禁止按滑鼠右鍵、選取及拖曳 -->
<body oncontextmenu="return false" onselectstart="return false" ondragstart="return false">
<!-- 禁止按滑鼠右鍵、選取及拖曳 end-->
<!-- 文字及數字判斷 -->
<input name="Chinese" type="text" size="4" maxlength="5" onKeyPress="if ((event.keyCode > 20) && (event.keyCode < 128)) event.returnValue = false;">
<input name="Number" type="text" size="4" maxlength="5" onKeyPress="if ((event.keyCode < 48) && (event.keyCode > 57)) event.returnValue = false;">
<!-- 文字及數字判斷 end-->
<!-- 文字標記的運用 -->
上引線 <a style="text-decoration: overline">AB</a>
下引線 <u>AB</u>
下標字 <sub>2</sub>
上標字 <sup>2</sup>
刪除線 <strike>原價100元</strike>
<!-- 文字標記的運用 end-->
<!-- 判斷日期格式 -->
<%
' 判斷日期格式是否正確,並判斷是否為閏年,二月為29天
Q_Date=ChangeText(request.form("Q_Year")) & "/" & ChangeText(request.form("Q_Month")) & "/" & ChangeText(request.form("Q_Day"))
if not IsDate(Q_Date) then
Q_Date=ChangeText(request.form("Q_Year")) & "/" & ChangeText(request.form("Q_Month")) & "/30"
if request.form("Q_Month")=2 and request.form("Q_Year") mod 4=0 then
Q_Date=ChangeText(request.form("Q_Year")) & "/" & ChangeText(request.form("Q_Month")) & "/29"
elseif request.form("Q_Month")=2 then
Q_Date=ChangeText(request.form("Q_Year")) & "/" & ChangeText(request.form("Q_Month")) & "/28"
end if
end if
<%
<!-- 判斷日期格式 end-->
<!-- 跑馬燈 -->
<marquee ScrollAmount=3 Onmouseover="this.stop()" Onmouseout="this.start()">跑馬燈</marquee>
<!-- 跑馬燈 end-->
<!-- 欄位內容判斷有無輸入值 -->
<input type=text name="In_Name" value="請輸入姓名" size="18" class="anla-blue-12"
onBlur="if(this.value=='') if(this.style.backgroundColor='#FFFFFF')this.value='請輸入姓名';"
onFocus="if(this.value.indexOf('請')!=-1) if(this.style.backgroundColor='#FFFCE3')this.value='';"
onMouseOver="this.focus();"
>
<!-- 欄位內容判斷有無輸入值 end-->
<!-- 檢查問題選項是否皆有勾選 -->
<script language="javascript">
function chkform(){
//檢查問題選項是否皆有勾選
var i,j,k;
ArrayK=new Array(5,4,4,5,5,5,5,4,19,17,6,6,2,5,2)
for(i=0;i<15;i++){
j=0;
for(k=0;k<ArrayK[i];k++){
str=eval('myform.Q'+(i+1));
if(str[k].checked==true) (j=j+1)
}
if(j == 0){
alert('問題 '+(i+1)+' 尚未回答...');
str[0].focus();
return;
}
}
myform.submit();
}
</script>
<!-- 檢查問題選項是否皆有勾選 end-->
<!-- 讓網頁無法儲存 -->
<noscript>
<iframe src="nothing.htm"></iframe>
</noscript>
<!-- 讓網頁無法儲存 end-->
<!-- 選取全部 start-->
function SelectAll(obj,strName){
for(var i=0; i<obj.elements.length; i++){
var e=obj.elements[i];
if(e.name == strName) {
if (e.checked == true) {e.checked=false;} else {e.checked=true;}
}
}
}
// <input type="button" name="Submit01" value="全選" onclick="SelectAll(this.form,'del');">
<!-- 選取全部 end-->
<!-- 開啟全視窗 start-->
function fullWindow(){
window.resizeTo(screen.availWidth,screen.availHeight);
window.moveTo(0,0);
//window.focus();
}
<body onLoad="fullWindow();">
<!-- 開啟全視窗 end-->
<!-- 使用 ASP 腳本防止緩存 start-->
通過給 ASP 文件添加腳本來防止緩存單獨的頁面。方法是將以下腳本添加到 ASP 文件內容的最前面:
Response.Expires = -1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache,must-revalidate"
<!-- 使用 ASP 腳本防止緩存 end-->
<!-- 取得目前下拉選單的名稱或值 start-->
名稱
myform.GameID1.options[myform.GameID1.selectedIndex].text
值
myform.GameID1.options[myform.GameID1.selectedIndex].value
<!-- 取得目前下拉選單的名稱或值 end-->
<!-- 清除所有 cookies 值 start-->
<%
For each cookie in Request.Cookies
Response.Cookies(cookie)=""
Response.Cookies(cookie).expires=Date()-1
for each key in Request.Cookies(cookie)
Response.Cookies(cookie)(key)=""
Response.Cookies(cookie)(key).expires=Date()-1
next
next
%>
<!-- 清除所有 cookies 值 end-->
<!-- 防止注入非法參數 start-->
<%
' 防止注入非法參數
sub checksqlin()
Dim Fy_Post1,Fy_Get1,Fy_In1,Fy_Inf1,Fy_Xh1,Fy_db1,Fy_dbstr1
'定義需要過濾的字串,用 "|" 分隔
Fy_In1 = "conn.open|conn.execute|exec|insert|select|delete|update|master|count|truncate|declare|execute|include|script|CreateObject|Server.MapPath|FileSystemObject|iframe"
Fy_Inf1 = split(Fy_In1,"|")
'--------POST部份-------------------
If Request.Form<>"" Then
For Each Fy_Post1 In Request.Form
For Fy_Xh1=0 To Ubound(Fy_Inf1)
If Instr(LCase(Request.Form(Fy_Post1)),Fy_Inf1(Fy_Xh1))<>0 Then
Response.Write "<Script Language=JavaScript>alert('系統提示你↓\n\n請不要在內容中包含非法參數字元\n\n請修改非法字元:\n\n"&Fy_Inf1(Fy_Xh1)&"\n\n');history.go(-1);</Script>"
Response.End()
End If
Next
Next
End If
'--------GET部份-------------------
If Request.QueryString<>"" Then
For Each Fy_Get1 In Request.QueryString
For Fy_Xh1=0 To Ubound(Fy_Inf1)
If Instr(LCase(Request.QueryString(Fy_Get1)),Fy_Inf1(Fy_Xh1))<>0 Then
Response.Write "<Script Language=JavaScript>alert('系統提示你↓\n\n請不要在內容中包含非法參數字元\n\n請修改非法字元:\n\n"&Fy_Inf1(Fy_Xh1)&"\n\n');history.go(-1);</Script>"
Response.End()
End If
Next
Next
End If
end sub
' 用下列方式呼叫驗證的副程式
if Request.Form<>"" or Request.QueryString<>"" then call checksqlin()
%>
<!-- 防止注入非法參數 end-->
<!-- 關閉中文輸入法,不能使用中文 start-->
<script language="javascript">
function onlyNumEng(){
if((event.keyCode<48)||((event.keyCode>=58)&&(event.keyCode<=64))||((event.keyCode>=91)&&(event.keyCode<=96))||(event.keyCode>122)){event.returnValue=false;}
}
</script>
<input type="text" name="NoChinese" value="" maxLength="10" onkeypress="onlyNumEng();" style="IME-MODE: disabled">
<!-- 關閉中文輸入法,不能使用中文 end-->
<!-- 禁止IE6圖片功能列 start-->
<meta http-equiv="ImageToolBar" content="NO">
<!-- 禁止IE6圖片功能列 end-->
<!-- 讀取用戶端瀏覽器狀態 start-->
首先於ASP程式加一行:<!--METADATA TYPE="Cookie" NAME="BrowsCap" SRC="cookie1.htm"-->
<%
' 讀取用戶端瀏覽器狀態
Set obj1 = Server.CreateObject("MSWC.BrowserType")
Response.Write "browser = " & obj1.browser & "<BR>"
Response.Write "version = " & obj1.version & "<BR>"
Response.Write "frames = " & obj1.frames & "<BR>"
Response.Write "tables = " & obj1.tables & "<BR>"
Response.Write "BackgroundSounds = " & obj1.BackgroundSounds & "<BR>"
Response.Write "vbscript = " & obj1.vbscript & "<BR>"
Response.Write "javascript = " & obj1.javascript & "<BR>"
Response.Write "platform = " & obj1.platform & "<BR>"
Response.Write "width = " & obj1.width & "<BR>"
Response.Write "height = " & obj1.height & "<BR>"
Response.Write "bufferDepth= " & obj1.bufferDepth & "<BR>"
Response.Write "colorDepth = " & obj1.colorDepth & "<BR>"
Response.Write "cookies = " & obj1.cookies & "<BR>"
%>
告訴瀏覽器先使用cookie1.htm中的DHTML語法偵測瀏覽器的資訊:
<HTML>
<HEAD>
<Script Language="JavaScript">
function window.onload ()
{
body1.style.behavior = "url(#default#clientCaps)";
bcString = "browse=" + body1.browser;
bcString += "&version=" + body1.version;
bcString += "&frames=" + body1.frames;
bcString += "&tables=" + body1.tables;
bcString += "&BackgroundSounds=" + body1.BackgroundSounds;
bcString += "&vbscript=" + body1.vbscript;
bcString += "&javascript=" + body1.javascript;
bcString += "&platform=" + body1.platform;
bcString += "&width=" + body1.width;
bcString += "&height=" + body1.height;
bcString += "&bufferDepth=" + body1.bufferDepth;
bcString += "&colorDepth=" + body1.colorDepth;
bcString += "&cookies=" + body1.cookieEnabled;
document.cookie = "BrowsCap = " + bcString;
}
</SCRIPT>
</HEAD>
<BODY ID="body1"></BODY>
<HTML>
<!-- 讀取用戶端瀏覽器狀態 end-->
<!-- 顯示所有檔案名稱 start-->
<%
' 顯示所有檔案名稱
Set fso=Server.CreateObject("Scripting.FileSystemObject")
fp=Server.MapPath("/")
set fod=fso.GetFolder(fp)
set fic=fod.Files
For Each fil In fic
Response.Write fil.Name & "<br>"
Next
set fic=nothing
set fod=nothing
set fso=nothing
%>
<!-- 顯示所有檔案名稱 end-->
<!-- 去除字串前後空白 start-->
<script>
String.prototype.trim = function()
{
return this.replace(/(^\s*)|(\s*$)/g, "");
}
str = " this is a sample ";
alert(str.trim());
</script>
<!-- 去除字串前後空白 end-->
<!-- 防止使用者重複按下Submit按鈕 start-->
<input type="button" value="Submit" onclick="this.disabled=true;this.form1.submit();"
<!-- 防止使用者重複按下Submit按鈕 end-->