公告板
 2007-01-18網址變更,請使用新網址瀏覽網站。http://blog.nnickk.com/
 2007-01-17有任何問題歡迎到留言板留言!
 廣告一則電腦桌椅專賣店,另有辦公桌椅、家具、寢具等您來挑...
  • 1 
瀏覽模式: 普通 | 列表

javascript的正則運算式

javascript的正則運算式

//校驗是否全由數字組成
function isDigit(s)
{
var patrn=/^[0-9]{1,20}$/;
if (!patrn.exec(s)) return false
return true
}

//校驗登錄名:只能輸入5-20個以字母開頭、可帶數位、“_”、“.”的字串
function isRegisterUserName(s)
{
var patrn=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/;
if (!patrn.exec(s)) return false
return true
}

//校驗用戶姓名:只能輸入1-30個以字母開頭的字串
function isTrueName(s)
{
var patrn=/^[a-zA-Z]{1,30}$/;
if (!patrn.exec(s)) return false
return true
}

//校驗密碼:只能輸入6-20個字母、數位、下劃線
function isPasswd(s)
{
var patrn=/^(w){6,20}$/;
if (!patrn.exec(s)) return false
return true
}

//校驗普通電話、傳真號碼:可以“+”開頭,除數字外,可含有“-”
function isTel(s)
{
//var patrn=/^[+]{0,1}(d){1,3}[ ]?([-]?(d){1,12})+$/;
var patrn=/^[+]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12})+$/;
if (!patrn.exec(s)) return false
return true
}

//校驗手機號碼:必須以數位開頭,除數字外,可含有“-”
function isMobil(s)
{
var patrn=/^[+]{0,1}(d){1,3}[ ]?([-]?((d)|[ ]){1,12})+$/;
if (!patrn.exec(s)) return false
return true
}

//校驗郵遞區號
function isPostalCode(s)
{
//var patrn=/^[a-zA-Z0-9]{3,12}$/;
var patrn=/^[a-zA-Z0-9 ]{3,12}$/;
if (!patrn.exec(s)) return false
return true
}

//校驗搜索關鍵字
function isSearch(s)
{
var patrn=/^[^`~!@#$%^&*()+=|][]{}:;',.<>/?]{1}[^`~!@$%^&()+=|][]{}:;',.<>?]{0,19}$/;
if (!patrn.exec(s)) return false
return true
}

function isIP(s) //by zergling
{
var patrn=/^[0-9.]{1,20}$/;
if (!patrn.exec(s)) return false
return true
}


正則運算式
"^d+$"  //非負整數(正整數 + 0)
"^[0-9]*[1-9][0-9]*$"  //正整數
"^((-d+)|(0+))$"  //非正整數(負整數 + 0)
"^-[0-9]*[1-9][0-9]*$"  //負整數
"^-?d+$"    //整數
"^d+(.d+)?$"  //非負浮點數(正浮點數 + 0)
"^(([0-9]+.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*.[0-9]+)|([0-9]*[1-9][0-9]*))$"  //正浮點數
"^((-d+(.d+)?)|(0+(.0+)?))$"  //非正浮點數(負浮點數 + 0)
"^(-(([0-9]+.[0-9]*[1-9][0-9]*)|([0-9]*[1-9][0-9]*.[0-9]+)|([0-9]*[1-9][0-9]*)))$"  //負浮點數
"^(-?d+)(.d+)?$"  //浮點數
"^[A-Za-z]+$"  //由26個英文字母組成的字串
"^[A-Z]+$"  //由26個英文字母的大寫組成的字串
"^[a-z]+$"  //由26個英文字母的小寫組成的字串
"^[A-Za-z0-9]+$"  //由數位和26個英文字母組成的字串
"^w+$"  //由數位、26個英文字母或者下劃線組成的字串
"^[w-]+(.[w-]+)*@[w-]+(.[w-]+)+$"    //email地址
"^[a-zA-z]+://(w+(-w+)*)(.(w+(-w+)*))*(?S*)?$"  //url

"^[A-Za-z0-9_]*$"
標籤:  javascript html

PJBlog-2.5-內容摘要允許html語法

修改class/cls_default.asp檔
尋找

UnCheckStr(UBBCode(webLogArr(10,PageCount),mid(webLogArr(14,PageCount),1,1),mid(webLogArr(14,PageCount),2,1),mid(webLogArr(14,PageCount),3,1),mid(webLogArr(14,PageCount),4,1),mid(webLogArr(14,PageCount),5,1)))

改成

HTMLDecode(UnCheckStr(UBBCode(webLogArr(10,PageCount),mid(webLogArr(14,PageCount),1,1),mid(webLogArr(14,PageCount),2,1),mid(webLogArr(14,PageCount),3,1),mid(webLogArr(14,PageCount),4,1),mid(webLogArr(14,PageCount),5,1))))


從此在 (內容摘要) (編輯內容摘要) ,
就是標題列表會出現的前4.5行,
不會對HTML語言進行阻擋,
但內容裡還是會過濾html語法。

另外,發表需要顯示html語法文章時,
請將自動轉換超連結取消,
也就是要禁止自動轉換超連結。
標籤:  pjblog html

form 換行問題

html的form會隔一行,
之前都是把他藏起來,
放在table跟tr之間,
其實還有一個解決方法,



margin: 上下左右間隔都設為 0px
display: inline 之後顯示的秀在同一行
標籤:  form 換行 html

清空input file value


onclick="document.form1.upfile1.select();document.execCommand('delete')"

修改UBB code可執行html語言,及UrMap地圖

今天修改了UBB Code,
讓特殊標籤可以執行html,
最主要是因為發現了一個好玩的UrMap地圖,
為了讓UrMap地圖可以在日誌裡出現,
所以修改了一下,
效果請參閱:
食:和民居食屋
標籤:  ubb urmap 地圖 html

常用Html語法

禁止頁面正文選取
&lt;body oncontextmenu=&quot;return false&quot; ondragstart=&quot;return false&quot; onselectstart =&quot;return false&quot; onselect=&quot;document.selection.empty()&quot; oncopy=&quot;document.selection.empty()&quot; onbeforecopy=&quot;return false&quot;onmouseup=&quot;document.selection.empty()&quot;&gt;

消除ie6自動出現的圖像工具欄,設置 GALLERYIMG屬性為false或no .
&lt;IMG SRC=&quot;mypicture.jpg&quot; HEIGHT=&quot;100px&quot; WIDTH=&quot;100px&quot; GALLERYIMG=&quot;no&quot;&gt;

防止點擊空鏈接時,頁面往往重置到頁首端。
代碼「java script:void(null)」代替原來的「#」標記

如何避免別人把你的網頁放在框架中
&lt;script language=「javascript」&gt;&lt;!--if (self!=top){top.location=self.location;} --&gt;&lt; /script&gt;

頁面定時刷新
&lt;meta http-equiv=&quot;Refresh&quot; content=&quot;秒&quot; &gt;

頁面定時轉向新的地址
&lt;meta http-equiv=&quot;refresh&quot; content=&quot;秒;URL=url&quot;&gt;

顯示日期
&lt;script language=&quot;JavaScript&quot;&gt;
&lt;!--
today=new Date();
var week; var date;
if(today.getDay()==0) week=&quot;星期日&quot;
if(today.getDay()==1) week=&quot;星期一&quot;
if(today.getDay()==2) week=&quot;星期二&quot;
if(today.getDay()==3) week=&quot;星期三&quot;
if(today.getDay()==4) week=&quot;星期四&quot;
if(today.getDay()==5) week=&quot;星期五&quot;
if(today.getDay()==6) week=&quot;星期六&quot;
date=(today.getYear())+&quot;年&quot;+(today.getMonth()+1)+&quot;月&quot;+today.getDate()+&quot;日&quot;+&quot; &quot;
documents.write(&quot;&lt;span style='font-size: 9pt;'&gt;&quot;+date+week+&quot;&lt;/span&gt;&quot;);
// --&gt;
&lt;/script&gt;

設為首頁
&lt;A href=# onclick=&quot;this.style.behavior='url(#default#homepage)';this.setHomePage('url');&quot;&gt;設為首頁&lt;/A&gt;

添加收藏
&lt;A href=&quot;java script:window.external.AddFavorite('url','title')&quot;&gt; 加入收藏夾&lt;/A&gt;


漸隱的特效
將下面的代碼複製到&lt;head&gt;~&lt;/head&gt;裡:
&lt;meta http-equiv=&quot;Page-Enter&quot; content=&quot;blendTrans(Duration=0.5)&quot;&gt;
&lt;meta http-equiv=&quot;Page-Exit&quot; content=&quot;blendTrans(Duration=0.5)&quot;&gt;

&lt;meta http-equiv=&quot;Page-Enter&quot; content=&quot;blendTrans(Duration=0.5)&quot;&gt; // 進入時漸隱
&lt;meta http-equiv=&quot;Page-Exit&quot; content=&quot;blendTrans(Duration=0.5)&quot;&gt;  // 退出時漸隱


網頁播放器~
特效名稱:十分棒的MIDI播放器
[共2步](可根據相應的項目修改)


1、將以下代碼加入HTML的&lt;head&gt;&lt;/head&gt;之間:
&lt;Script Language=&quot;JavaScript&quot;&gt;
&lt;!-- Hiding
song = new Array()
var x = 0
song[1] = &quot;Mid1&quot;
song[2] = &quot;Mid2&quot;
song[3] = &quot;Mid3&quot;
song[4] = &quot;mid1&quot;
song[5] = &quot;mid2&quot;
song[6] = &quot;mid3&quot;
function prev(){
if (x&gt;1)
{ x--
document.midi.typein.value=song [x]
}
}
function next(){
var max= song.length-1
if (x&lt;max)
{ x++
document.midi.typein.value=song [x]
}
}
function go(){
if (x != 0){
location.href='mid'+x+'.mid'
//以上指定播放的是當前路徑的midi文件,文件名分別是mid1.mid-mid6.mid //
}
}
function start(){
x=1
document.midi.typein.value=song [x]
}
function end(){
x=song.length-1
document.midi.typein.value=song [x]
}
function cls(){
document.midi.typein.value=&quot;選曲&quot;
}
// Done Hiding --&gt;
&lt;/Script&gt;


2、將以下代碼加入HTML的&lt;body&gt;&lt;/body&gt;之間區:


&lt;BODY onload=&quot;cls()&quot;&gt;
&lt;FORM Name=&quot;midi&quot;&gt;
&lt;INPUT NAME=&quot;typein&quot; TYPE=&quot;text&quot; SIZE=&quot;25&quot; ALIGN=top&gt;&lt;BR&gt;
&lt;font size=3&gt;
&lt;INPUT TYPE=Button Value=&quot;|&lt;&lt;&quot; Align=left onclick=&quot;start()&quot;&gt;
&lt;INPUT TYPE=Button Value=&quot;&lt;&lt;&quot; Align=left onclick=&quot;prev()&quot;&gt;
&lt;input type=Button value=&quot;PLAY&quot; align=left onClick=&quot;go()&quot; name=&quot;Button&quot;&gt;
&lt;INPUT TYPE=Button Value=&quot;&gt;&gt;&quot; Align=left onclick=&quot;next()&quot;&gt;
&lt;INPUT TYPE=Button Value=&quot;&gt;&gt;|&quot; Align=left onclick=&quot;end()&quot;&gt;
&lt;/font&gt;
&lt;/FORM&gt;


跟隨鼠標飄動的時鐘
&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;&gt;
&lt;HTML&gt;&lt;HEAD&gt;
&lt;META http-equiv=Content-Type content=&quot;text/html; charset=windows-1252&quot;&gt;
&lt;META content=&quot;MSHTML 6.00.2600.0&quot; name=GENERATOR&gt;&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;SCRIPT language=JavaScript&gt;
dCol='000000';//date colour.
fCol='000000';//face colour.
sCol='000000';//seconds colour.
mCol='000000';//minutes colour.
hCol='000000';//hours colour.
ClockHeight=40;
ClockWidth=40;
ClockFromMouseY=0;
ClockFromMouseX=100;


//Alter nothing below! Alignments will be lost!


d=new Array(&quot;SUNDAY&quot;,&quot;MONDAY&quot;,&quot;TUESDAY&quot;,&quot;WEDNESDAY&quot;,&quot;THURSDAY&quot;,&quot;FRIDAY&quot;,&quot;SATURDAY&quot;;
m=new Array(&quot;JANUARY&quot;,&quot;FEBRUARY&quot;,&quot;MARCH&quot;,&quot;APRIL&quot;,&quot;MAY&quot;,&quot;JUNE&quot;,&quot;JULY&quot;,&quot;AUGUST&quot;,&quot;SEPTEMBER&quot;,&quot;OCTOBER&quot;,&quot;NOVEMBER&quot;,&quot;DECEMBER&quot;;
date=new Date();
day=date.getDate();
year=date.getYear();
if (year &lt; 2000) year=year+1900;
TodaysDate=&quot; &quot;+d[date.getDay()]+&quot; &quot;+day+&quot; &quot;+m[date.getMonth()]+&quot; &quot;+year;
D=TodaysDate.split('');
H='...';
H=H.split('');
M='....';
M=M.split('');
S='.....';
S=S.split('');
Face='1 2 3 4 5 6 7 8 9 10 11 12';
font='Arial';
size=1;
speed=0.6;
ns=(document.layers);
ie=(document.all);
Face=Face.split(' ');
n=Face.length;
a=size*10;
ymouse=0;
xmouse=0;
scrll=0;
props=&quot;&lt;font face=&quot;+font+&quot; size=&quot;+size+&quot; color=&quot;+fCol+&quot;&gt;&lt;B&gt;&quot;;
props2=&quot;&lt;font face=&quot;+font+&quot; size=&quot;+size+&quot; color=&quot;+dCol+&quot;&gt;&lt;B&gt;&quot;;
Split=360/n;
Dsplit=360/D.length;
HandHeight=ClockHeight/4.5
HandWidth=ClockWidth/4.5
HandY=-7;
HandX=-2.5;
scrll=0;
step=0.06;
currStep=0;
y=new Array();x=new Array();Y=new Array();X=new Array();
for (i=0; i &lt; n; i++){y=0;x=0;Y=0;X=0}
Dy=new Array();Dx=new Array();DY=new Array();DX=new Array();
for (i=0; i &lt; D.length; i++){Dy=0;Dx=0;DY=0;DX=0}
if (ns){
for (i=0; i &lt; D.length; i++)
documents.write('&lt;layer name=&quot;nsDate'+i+'&quot; top=0 left=0 height='+a+' width='+a+'&gt;&lt;center&gt;'+props2+D+'&lt;/font&gt;&lt;/center&gt;&lt;/layer&gt;');
for (i=0; i &lt; n; i++)
documents.write('&lt;layer name=&quot;nsFace'+i+'&quot; top=0 left=0 height='+a+' width='+a+'&gt;&lt;center&gt;'+props+Face+'&lt;/font&gt;&lt;/center&gt;&lt;/layer&gt;');
for (i=0; i &lt; S.length; i++)
documents.write('&lt;layer name=nsSeconds'+i+' top=0 left=0 width=15 height=15&gt;&lt;font face=Arial size=3 color='+sCol+'&gt;&lt;center&gt;&lt;b&gt;'+S+'&lt;/b&gt;&lt;/center&gt;&lt;/font&gt;&lt;/layer&gt;');
for (i=0; i &lt; M.length; i++)
documents.write('&lt;layer name=nsMinutes'+i+' top=0 left=0 width=15 height=15&gt;&lt;font face=Arial size=3 color='+mCol+'&gt;&lt;center&gt;&lt;b&gt;'+M+'&lt;/b&gt;&lt;/center&gt;&lt;/font&gt;&lt;/layer&gt;');
for (i=0; i &lt; H.length; i++)
documents.write('&lt;layer name=nsHours'+i+' top=0 left=0 width=15 height=15&gt;&lt;font face=Arial size=3 color='+hCol+'&gt;&lt;center&gt;&lt;b&gt;'+H+'&lt;/b&gt;&lt;/center&gt;&lt;/font&gt;&lt;/layer&gt;');
}
if (ie){
documents.write('&lt;div id=&quot;Od&quot; style=&quot;position:absolute;top:0px;left:0px&quot;&gt;&lt;div style=&quot;position:relative&quot;&gt;');
for (i=0; i &lt; D.length; i++)
documents.write('&lt;div id=&quot;ieDate&quot; style=&quot;position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center&quot;&gt;'+props2+D+'&lt;/B&gt;&lt;/font&gt;&lt;/div&gt;');
documents.write('&lt;/div&gt;&lt;/div&gt;');
documents.write('&lt;div id=&quot;Of&quot; style=&quot;position:absolute;top:0px;left:0px&quot;&gt;&lt;div style=&quot;position:relative&quot;&gt;');
for (i=0; i &lt; n; i++)
documents.write('&lt;div id=&quot;ieFace&quot; style=&quot;position:absolute;top:0px;left:0;height:'+a+';width:'+a+';text-align:center&quot;&gt;'+props+Face+'&lt;/B&gt;&lt;/font&gt;&lt;/div&gt;');
documents.write('&lt;/div&gt;&lt;/div&gt;');
documents.write('&lt;div id=&quot;Oh&quot; style=&quot;position:absolute;top:0px;left:0px&quot;&gt;&lt;div style=&quot;position:relative&quot;&gt;');
for (i=0; i &lt; H.length; i++)
documents.write('&lt;div id=&quot;ieHours&quot; style=&quot;position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+hCol+';text-align:center;font-weight:bold&quot;&gt;'+H+'&lt;/div&gt;');
documents.write('&lt;/div&gt;&lt;/div&gt;');
documents.write('&lt;div id=&quot;Om&quot; style=&quot;position:absolute;top:0px;left:0px&quot;&gt;&lt;div style=&quot;position:relative&quot;&gt;');
for (i=0; i &lt; M.length; i++)
documents.write('&lt;div id=&quot;ieMinutes&quot; style=&quot;position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+mCol+';text-align:center;font-weight:bold&quot;&gt;'+M+'&lt;/div&gt;');
documents.write('&lt;/div&gt;&lt;/div&gt;')
documents.write('&lt;div id=&quot;Os&quot; style=&quot;position:absolute;top:0px;left:0px&quot;&gt;&lt;div style=&quot;position:relative&quot;&gt;');
for (i=0; i &lt; S.length; i++)
documents.write('&lt;div id=&quot;ieSeconds&quot; style=&quot;position:absolute;width:16px;height:16px;font-family:Arial;font-size:16px;color:'+sCol+';text-align:center;font-weight:bold&quot;&gt;'+S+'&lt;/div&gt;');
documents.write('&lt;/div&gt;&lt;/div&gt;')
}
(ns)?window.captureEvents(Event.MOUSEMOVE):0;
function Mouse(evnt){
ymouse = (ns)?evnt.pageY+ClockFromMouseY-(window.pageYOffset):event.y+ClockFromMouseY;
xmouse = (ns)?evnt.pageX+ClockFromMouseX:event.x+ClockFromMouseX;
}
(ns)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
function ClockAndAssign(){
time = new Date ();
secs = time.getSeconds();
sec = -1.57 + Math.PI * secs/30;
mins = time.getMinutes();
min = -1.57 + Math.PI * mins/30;
hr = time.getHours();
hrs = -1.575 + Math.PI * hr/6+Math.PI*parseInt(time.getMinutes())/360;
if (ie){
Od.style.top=window.document.body.scrollTop;
Of.style.top=window.document.body.scrollTop;
Oh.style.top=window.document.body.scrollTop;
Om.style.top=window.document.body.scrollTop;
Os.style.top=window.document.body.scrollTop;
}
for (i=0; i &lt; n; i++){
var F=(ns)?document.layers['nsFace'+i]:ieFace.style;
F.top=y + ClockHeight*Math.sin(-1.0471 + i*Split*Math.PI/180)+scrll;
F.left=x + ClockWidth*Math.cos(-1.0471 + i*Split*Math.PI/180);
}
for (i=0; i &lt; H.length; i++){
var HL=(ns)?document.layers['nsHours'+i]:ieHours.style;
HL.top=y+HandY+(i*HandHeight)*Math.sin(hrs)+scrll;
HL.left=x+HandX+(i*HandWidth)*Math.cos(hrs);
}
for (i=0; i &lt; M.length; i++){
var ML=(ns)?document.layers['nsMinutes'+i]:ieMinutes.style;
ML.top=y+HandY+(i*HandHeight)*Math.sin(min)+scrll;
ML.left=x+HandX+(i*HandWidth)*Math.cos(min);
}
for (i=0; i &lt; S.length; i++){
var SL=(ns)?document.layers['nsSeconds'+i]:ieSeconds.style;
SL.top=y+HandY+(i*HandHeight)*Math.sin(sec)+scrll;
SL.left=x+HandX+(i*HandWidth)*Math.cos(sec);
}
for (i=0; i &lt; D.length; i++){
var DL=(ns)?document.layers['nsDate'+i]:ieDate.style;
DL.top=Dy + ClockHeight*1.5*Math.sin(currStep+i*Dsplit*Math.PI/180)+scrll;
DL.left=Dx + ClockWidth*1.5*Math.cos(currStep+i*Dsplit*Math.PI/180);
}
currStep-=step;
}
function Delay(){
scrll=(ns)?window.pageYOffset:0;
Dy[0]=Math.round(DY[0]+=((ymouse)-DY[0])*speed);
Dx[0]=Math.round(DX[0]+=((xmouse)-DX[0])*speed);
for (i=1; i &lt; D.length; i++){
Dy=Math.round(DY+=(Dy[i-1]-DY)*speed);
Dx=Math.round(DX+=(Dx[i-1]-DX)*speed);
}
y[0]=Math.round(Y[0]+=((ymouse)-Y[0])*speed);
x[0]=Math.round(X[0]+=((xmouse)-X[0])*speed);
for (i=1; i &lt; n; i++){
y=Math.round(Y+=(y[i-1]-Y)*speed);
x=Math.round(X+=(x[i-1]-X)*speed);
}
ClockAndAssign();
setTimeout('Delay()',20);
}
if (ns||ie)window.onload=Delay;
&lt;/SCRIPT&gt;
&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;BR&gt;&lt;FONT color=blue&gt;Hi Guys this is
amazing.&lt;/FONT size=20 Color=red&gt;&lt;BR&gt;I do not know who wrote this HTML code.&lt;br&gt;Asoka Liyanage.&lt;/BODY&gt;&lt;/HTML&gt;


1. oncontextmenu=&quot;window.event.returnValue=false&quot; 將徹底屏蔽鼠標右鍵
&lt;table border oncontextmenu=return(false)&gt;&lt;td&gt;no&lt;/table&gt; 可用於Table


2. &lt;body onselectstart=&quot;return false&quot;&gt; 取消選取、防止複製


3. onpaste=&quot;return false&quot; 不准粘貼


4. oncopy=&quot;return false;&quot; oncut=&quot;return false;&quot; 防止複製


5. &lt;link rel=&quot;Shortcut Icon&quot; href=&quot;favicon.ico&quot;&gt; IE地址欄前換成自己的圖標


6. &lt;link rel=&quot;Bookmark&quot; href=&quot;favicon.ico&quot;&gt; 可以在收藏夾中顯示出你的圖標


7. &lt;input style=&quot;ime-mode:disabled&quot;&gt; 關閉輸入法


8. 永遠都會帶著框架
&lt;script language=&quot;JavaScript&quot;&gt;&lt;!--
if (window == top)top.location.href = &quot;frames.htm&quot;; //frames.htm為框架網頁
// --&gt;&lt;/script&gt;


9. 防止被人frame
&lt;SCRIPT LANGUAGE=JAVASCRIPT&gt;&lt;!--
if (top.location != self.location)top.location=self.location;
// --&gt;&lt;/SCRIPT&gt;


10. 網頁將不能被另存為
&lt;noscript&gt;&lt;iframe src=*.html&gt;&lt;/iframe&gt;&lt;/noscript&gt;


11.查看網頁源代碼
&lt;input type=button value=查看網頁源代碼 onclick=&quot;window.location = &quot;view-source:&quot;+ &quot;http://www.51js.com/&quot;&quot;&gt;


12.刪除時確認
&lt;a href=&quot;java script:if(confirm(&quot;確實要刪除嗎?&quot;))location=&quot;boos.asp?&amp;areyou=刪除&amp;page=1&quot;&quot;&gt;刪
除&lt;/a&gt;


13. 取得控件的絕對位置
//Javascript
&lt;script language=&quot;Javascript&quot;&gt;
function getIE(e){
var t=e.offsetTop;
var l=e.offsetLeft;
while(e=e.offsetParent){
t+=e.offsetTop;
l+=e.offsetLeft;
}
alert(&quot;top=&quot;+t+&quot;/nleft=&quot;+l);
}
&lt;/script&gt;
//VBScript
&lt;script language=&quot;VBScript&quot;&gt;&lt;!--
function getIE()
dim t,l,a,b
set a=document.all.img1
t=document.all.img1.offsetTop
l=document.all.img1.offsetLeft
while a.tagName&lt;&gt;&quot;BODY&quot;
set a = a.offsetParent
t=t+a.offsetTop
l=l+a.offsetLeft
wend
msgbox &quot;top=&quot;&amp;t&amp;chr(13)&amp;&quot;left=&quot;&amp;l,64,&quot;得到控件的位置&quot;
end function
--&gt;&lt;/script&gt;


14. 光標是停在文本框文字的最後
&lt;script language=&quot;javascript&quot;&gt;
function cc()
{
var e = event.srcElement;
var r =e.createTextRange();
r.moveStart(&quot;character&quot;,e.value.length);
r.collapse(true);
r.select();
}
&lt;/script&gt;
&lt;input type=text name=text1 value=&quot;123&quot; onfocus=&quot;cc()&quot;&gt;


15. 判斷上一頁的來源
java script:
document.referrer


16. 最小化、最大化、關閉窗口
&lt;object id=hh1 classid=&quot;clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11&quot;&gt;
&lt;param name=&quot;Command&quot; value=&quot;Minimize&quot;&gt;&lt;/object&gt;
&lt;object id=hh2 classid=&quot;clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11&quot;&gt;
&lt;param name=&quot;Command&quot; value=&quot;Maximize&quot;&gt;&lt;/object&gt;
&lt;OBJECT id=hh3 classid=&quot;clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11&quot;&gt;
&lt;PARAM NAME=&quot;Command&quot; VALUE=&quot;Close&quot;&gt;&lt;/OBJECT&gt;
&lt;input type=button value=最小化 onclick=hh1.Click()&gt;
&lt;input type=button value=最大化 onclick=hh2.Click()&gt;
&lt;input type=button value=關閉 onclick=hh3.Click()&gt;
本例適用於IE


17.屏蔽功能鍵Shift,Alt,Ctrl
&lt;script&gt;
function look(){
if(event.shiftKey)
alert(&quot;禁止按Shift鍵!&quot;); //可以換成ALT CTRL
}
document.onkeydown=look;
&lt;/script&gt;


18. 網頁不會被緩存
&lt;META HTTP-EQUIV=&quot;pragma&quot; CONTENT=&quot;no-cache&quot;&gt;
&lt;META HTTP-EQUIV=&quot;Cache-Control&quot; CONTENT=&quot;no-cache, must-revalidate&quot;&gt;
&lt;META HTTP-EQUIV=&quot;expires&quot; CONTENT=&quot;Wed, 26 Feb 1997 08:21:57 GMT&quot;&gt;
或者&lt;META HTTP-EQUIV=&quot;expires&quot; CONTENT=&quot;0&quot;&gt;


19.怎樣讓表單沒有凹凸感?
&lt;input type=text style=&quot;border:1 solid #000000&quot;&gt;

&lt;input type=text style=&quot;border-left:none; border-right:none; border-top:none; border-bottom:
1solid #000000&quot;&gt;&lt;/textarea&gt;


20.&lt;div&gt;&lt;span&gt;&amp;&lt;layer&gt;的區別?
&lt;div&gt;(division)用來定義大段的頁面元素,會產生轉行
&lt;span&gt;用來定義同一行內的元素,跟&lt;div&gt;的唯一區別是不產生轉行
&lt;layer&gt;是ns的標記,ie不支持,相當於&lt;div&gt;


21.讓彈出窗口總是在最上面:
&lt;body onblur=&quot;this.focus();&quot;&gt;


22.不要滾動條?
讓豎條沒有:
&lt;body style=&quot;overflow:scroll;overflow-y:hidden&quot;&gt;
&lt;/body&gt;
讓橫條沒有:
&lt;body style=&quot;overflow:scroll;overflow-x:hidden&quot;&gt;
&lt;/body&gt;
兩個都去掉?更簡單了
&lt;body scroll=&quot;no&quot;&gt;
&lt;/body&gt;


23.怎樣去掉圖片鏈接點擊後,圖片周圍的虛線?
&lt;a href=&quot;#&quot; onFocus=&quot;this.blur()&quot;&gt;&lt;img src=&quot;logo.jpg&quot; border=0&gt;&lt;/a&gt;


24.電子郵件處理提交表單
&lt;form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;mailto:****@***.com&quot; enctype=&quot;text/plain&quot;&gt;
&lt;input type=submit&gt;
&lt;/form&gt;


25.在打開的子窗口刷新父窗口的代碼裡如何寫?
windows.opener.location.reload()


26.如何設定打開頁面的大小
&lt;body onload=&quot;top.resizeTo(300,200);&quot;&gt;
打開頁面的位置&lt;body onload=&quot;top.moveBy(300,200);&quot;&gt;


27.在頁面中如何加入不是滿鋪的背景圖片,拉動頁面時背景圖不動
&lt;STYLE&gt;
body
{background-image:url(logo.gif); background-repeat:no-repeat;
background-position:center;background-attachment: fixed}
&lt;/STYLE&gt;


28. 檢查一段字符串是否全由數字組成
&lt;script language=&quot;Javascript&quot;&gt;&lt;!--
function checkNum(str){return str.match(//D/)==null}
alert(checkNum(&quot;1232142141&quot;))
alert(checkNum(&quot;123214214a1&quot;))
// --&gt;&lt;/script&gt;


29. 獲得一個窗口的大小
document.body.clientWidth; document.body.clientHeight


30. 怎麼判斷是否是字符
if (/[^/x00-/xff]/g.test(s)) alert(&quot;含有漢字&quot;);
else alert(&quot;全是字符&quot;);


31.TEXTAREA自適應文字行數的多少
&lt;textarea rows=1 name=s1 cols=27 onpropertychange=&quot;this.style.posHeight=this.scrollHeight&quot;&gt;
&lt;/textarea&gt;


32. 日期減去天數等於第二個日期
&lt;script language=Javascript&gt;
function cc(dd,dadd)
{
//可以加上錯誤處理
var a = new Date(dd)
a = a.valueOf()
a = a - dadd * 24 * 60 * 60 * 1000
a = new Date(a)
alert(a.getFullYear() + &quot;年&quot; + (a.getMonth() + 1) + &quot;月&quot; + a.getDate() + &quot;日&quot;)
}
cc(&quot;12/23/2002&quot;,2)
&lt;/script&gt;


33. 選擇了哪一個Radio
&lt;HTML&gt;&lt;script language=&quot;vbscript&quot;&gt;
function checkme()
for each ob in radio1
if ob.checked then window.alert ob.value
next
end function
&lt;/script&gt;&lt;BODY&gt;
&lt;INPUT name=&quot;radio1&quot; type=&quot;radio&quot; value=&quot;style&quot; checked&gt;Style
&lt;INPUT name=&quot;radio1&quot; type=&quot;radio&quot; value=&quot;barcode&quot;&gt;Barcode
&lt;INPUT type=&quot;button&quot; value=&quot;check&quot; onclick=&quot;checkme()&quot;&gt;
&lt;/BODY&gt;&lt;/HTML&gt;


34.腳本永不出錯
&lt;SCRIPT LANGUAGE=&quot;JavaScript&quot;&gt;
&lt;!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
// --&gt;
&lt;/SCRIPT&gt;


35.ENTER鍵可以讓光標移到下一個輸入框
&lt;input onkeydown=&quot;if(event.keyCode==13)event.keyCode=9&quot;&gt;


36. 檢測某個網站的鏈接速度
把如下代碼加入&lt;body&gt;區域中:
&lt;script language=Javascript&gt;
tim=1
setInterval(&quot;tim++&quot;,100)
b=1
var autourl=new Array()
autourl[1]=&quot;www.njcatv.net&quot;
autourl[2]=&quot;javacool.3322.net&quot;
autourl[3]=&quot;www.sina.com.cn&quot;
autourl[4]=&quot;www.nuaa.edu.cn&quot;
autourl[5]=&quot;www.cctv.com&quot;
function butt(){
documents.write(&quot;&lt;form name=autof&gt;&quot;)
for(var i=1;i&lt;autourl.length;i++)
documents.write(&quot;&lt;input type=text name=txt&quot;+i+&quot; size=10 value=測試中&hellip;&hellip;&gt; =》&lt;input type=text
name=url&quot;+i+&quot; size=40&gt; =》&lt;input type=button value=GO
onclick=windows.open(this.form.url&quot;+i+&quot;.value)&gt;&lt;br&gt;&quot;)
documents.write(&quot;&lt;input type=submit value=刷新&gt;&lt;/form&gt;&quot;)
}
butt()
function auto(url){
document.forms[0][&quot;url&quot;+b].value=url
if(tim&gt;200)
{document.forms[0][&quot;txt&quot;+b].value=&quot;鏈接超時&quot;}
else
{document.forms[0][&quot;txt&quot;+b].value=&quot;時間&quot;+tim/10+&quot;秒&quot;}
b++
}
function run(){for(var i=1;i&lt;autourl.length;i++)documents.write(&quot;&lt;img
src=http://&quot;+autourl+&quot;/&quot;+Math.random()+&quot; width=1 height=1
onerror=auto(&quot;http://&quot;+autourl+&quot;&quot;)&gt;&quot;)}
run()&lt;/script&gt;


37. 各種樣式的光標
style=&quot;cursor:hand&quot;
auto :標準光標
default :標準箭頭
hand :手形光標
wait :等待光標
text :I形光標
vertical-text :水平I形光標
no-drop :不可拖動光標
not-allowed :無效光標
help :?幫助光標
all-scroll :三角方向標
move :移動標
crosshair :十字標
e-resize
n-resize
nw-resize
w-resize
s-resize
se-resize
sw-resize


38.頁面進入和退出的特效
進入頁面&lt;meta http-equiv=&quot;Page-Enter&quot; content=&quot;revealTrans(duration=x, transition=y)&quot;&gt;
推出頁面&lt;meta http-equiv=&quot;Page-Exit&quot; content=&quot;revealTrans(duration=x, transition=y)&quot;&gt;
這個是頁面被載入和調出時的一些特效。duration表示特效的持續時間,以秒為單位。transition表示使
用哪種特效,取值為1-23:
   0 矩形縮小
   1 矩形擴大
   2 圓形縮小
   3 圓形擴大
   4 下到上刷新
   5 上到下刷新
   6 左到右刷新
   7 右到左刷新
   8 豎百葉窗
   9 橫百葉窗
   10 錯位橫百葉窗
   11 錯位豎百葉窗
   12 點擴散
   13 左右到中間刷新
   14 中間到左右刷新
   15 中間到上下
   16 上下到中間
   17 右下到左上
   18 右上到左下
   19 左上到右下
   20 左下到右上
   21 橫條
   22 豎條
   23 以上22種隨機選擇一種


39.在規定時間內跳轉
&lt;META http-equiv=V=&quot;REFRESH&quot; content=&quot;5;URL=http://www.51js.com&quot;&gt;


40.網頁是否被檢索
&lt;meta name=&quot;ROBOTS&quot; content=&quot;屬性值&quot;&gt;
  其中屬性值有以下一些:
  屬性值為 &quot;all&quot;: 文件將被檢索,且頁上鏈接可被查詢;
  屬性值為 &quot;none&quot;: 文件不被檢索,而且不查詢頁上的鏈接;
  屬性值為 &quot;index&quot;: 文件將被檢索;
  屬性值為 &quot;follow&quot;: 查詢頁上的鏈接;
  屬性值為 &quot;noindex&quot;: 文件不檢索,但可被查詢鏈接;
  屬性值為 &quot;nofollow&quot;: 文件不被檢索,但可查詢頁上的鏈接。


js多層菜單
&lt;!-- Saved From url=http://js.jojoo.net --&gt;
&lt;!-- Web Design bbs url=http://www.qybbs.net--&gt;
&lt;html&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=gb2312&quot;&gt;
&lt;meta name=&quot;keywords&quot; content=&quot;&quot;&gt;
&lt;style type=text/css&gt;
body { background:#799AE1; margin:0px; font:normal 12px 細明體; }
table { border:0px; }
td { font:normal 12px 細明體; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 細明體; color:#215DC6; text-decoration:none; }
a:hover { color:#428EFF }
.sec_menu { border-left:1px solid white; border-right:1px solid white; border-bottom:1px solid white; overflow:hidden; background:#D6DFF7; }
.menu_title { }
.menu_title span { position:relative; top:2px; left:8px; color:#215DC6; font-weight:bold; }
.menu_title2 { }
.menu_title2 span { position:relative; top:2px; left:8px; color:#428EFF; font-weight:bold; }
&lt;/style&gt;
&lt;script language=javascript&gt;
function menuShow(obj,maxh,obj2)
{
if(obj.style.pixelHeight&lt;maxh)
{
obj.style.pixelHeight+=maxh/20;
obj.filters.alpha.opacity+=5;
obj2.background=&quot;http://images.jojoo.net/js/title_bg_hide.gif&quot;;;
if(obj.style.pixelHeight==maxh/10)
obj.style.display='block';
myObj=obj;
myMaxh=maxh;
myObj2=obj2;
setTimeout('menuShow(myObj,myMaxh,myObj2)','5');
}
}
function menuHide(obj,maxh,obj2)
{
if(obj.style.pixelHeight&gt;0)
{
if(obj.style.pixelHeight==maxh/20)
obj.style.display='none';
obj.style.pixelHeight-=maxh/20;
obj.filters.alpha.opacity-=5;
obj2.background=&quot;http://images.jojoo.net/js/title_bg_show.gif&quot;;;
myObj=obj;
myMaxh=maxh
myObj2=obj2;
setTimeout('menuHide(myObj,myMaxh,myObj2)','5');
}
else
if(whichContinue)
whichContinue.click();
}
function menuChange(obj,maxh,obj2)
{
if(obj.style.pixelHeight)
{
menuHide(obj,maxh,obj2);
whichOpen='';
whichcontinue='';
}
else
if(whichOpen)
{
whichContinue=obj2;
whichOpen.click();
}
else
{
menuShow(obj,maxh,obj2);
whichOpen=obj2;
whichContinue='';
}
}
&lt;/script&gt;
&lt;base target=main&gt;
&lt;/head&gt;


&lt;body onselectstart=&quot;return false;&quot; ondragstart=&quot;return false;&quot; oncontextmenu=&quot;return false;&quot;&gt;
&lt;table cellpadding=0 cellspacing=0 width=158 align=center&gt;
&lt;tr style=&quot;cursor:hand;&quot;&gt;
&lt;td height=42 valign=bottom&gt;
&lt;img src=http://images.jojoo.net/js/title.gif width=158 height=38&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


&lt;table cellpadding=0 cellspacing=0 width=158 align=center&gt;
&lt;tr style=&quot;cursor:hand;&quot;&gt;
&lt;td height=25 class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; background=http://images.jojoo.net/js/title_bg_hide.gif id=menuTitle1 onclick=&quot;menuChange(menu1,80,menuTitle1);&quot;&gt;
&lt;span&gt;系統選項&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;div class=sec_menu style=&quot;width:158px;height:80px;filter:alpha(Opacity=100);overflow:hidden;&quot; id=menu1&gt;
&lt;table cellpadding=0 cellspacing=0 align=center width=135 style=&quot;position:relative;top:10px;&quot;&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_safe.gif&gt;
安全選項&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_recycle.gif&gt;
垃圾郵件選項&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_dynamic.gif&gt;
動態規則選項&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;script language=javascript&gt;
var whichOpen=menuTitle1;
var whichContinue='';
&lt;/script&gt;


&lt;table cellpadding=0 cellspacing=0 width=158 align=center&gt;
&lt;tr style=&quot;cursor:hand;&quot;&gt;
&lt;tdheight=25 class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; background=http://images.jojoo.net/js/title_bg_show.gif id=menuTitle2 onclick=&quot;menuChange(menu2,120,menuTitle2);&quot;&gt;
&lt;span&gt;系統規則&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;div class=sec_menu style=&quot;width:158;height:0;filter:alpha(Opacity=0);display:none;&quot; id=menu2&gt;
&lt;table cellpadding=0 cellspacing=0 align=center width=135 style=&quot;position:relative;top:10px;&quot;&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_ip.gif&gt;
IP過濾規則&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_mailer.gif&gt;
信封過濾規則&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_mailheader.gif&gt;
信頭過濾規則&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_mailbody.gif&gt;
信體過濾規則&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_accessory.gif&gt;
附件過濾規則&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


&lt;table cellpadding=0 cellspacing=0 width=158 align=center&gt;
&lt;tr style=&quot;cursor:hand;&quot;&gt;
&lt;td height=25 class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; background=http://images.jojoo.net/js/title_bg_show.gif id=menuTitle3 onclick=&quot;menuChange(menu3,120,menuTitle3);&quot;&gt;
&lt;span&gt;系統管理&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;div class=sec_menu style=&quot;width:158;height:0;filter:alpha(Opacity=0);display:none;&quot; id=menu3&gt;
&lt;table cellpadding=0 cellspacing=0 align=center width=135 style=&quot;position:relative;top:10px;&quot;&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_user.gif&gt;
用戶管理&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_course.gif&gt;
進程管理&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_host.gif&gt;
主機運行狀態&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_data.gif&gt;
數據備份&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_recycle.gif&gt;
垃圾目錄管理&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


&lt;table cellpadding=0 cellspacing=0 width=158 align=center&gt;
&lt;tr style=&quot;cursor:hand;&quot;&gt;
&lt;td height=25 class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; background=http://images.jojoo.net/js/title_bg_show.gif id=menuTitle4 onclick=&quot;menuChange(menu4,140,menuTitle4);&quot;&gt;
&lt;span&gt;系統統計&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;div class=sec_menu style=&quot;width:158;height:0;filter:alpha(Opacity=0);display:none;&quot; id=menu4&gt;
&lt;table cellpadding=0 cellspacing=0 align=center width=135 style=&quot;position:relative;top:10px;&quot;&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_ip.gif&gt;
IP過濾統計&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_mailer.gif&gt;
信封過濾統計&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_mailheader.gif&gt;
信頭過濾統計&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_mailbody.gif&gt;
信體過濾統計&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_accessory.gif&gt;
附件過濾統計&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td height=20&gt;
&lt;a href=http://qybbs.net onfocus=this.blur();&gt;&lt;img src=http://images.jojoo.net/js/icon_dynamic.gif&gt;
動態規則統計&lt;/a&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;


&lt;table cellpadding=0 cellspacing=0 width=158 align=center&gt;
&lt;tr style=&quot;cursor:hand;&quot;&gt;
&lt;td height=25 class=menu_title onmouseover=this.className='menu_title2'; onmouseout=this.className='menu_title'; background=http://images.jojoo.net/js/title_bg_quit.gif&gt;
&lt;span&gt;退出系統&lt;/span&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;


&lt;/html&gt;


1.獲得系統時間:
  &lt;%=now()%&gt;


2.取得來訪用的IP:
&lt;%=request.server&lt;I&gt;var&lt;/I&gt;iables(&quot;remote_host&quot;)%&gt;


3.獲得系統,瀏覽器版本:
&lt;&lt;I&gt;script&lt;/I&gt;&gt;
&lt;I&gt;window&lt;/I&gt;.documents.write(&quot;版本:&quot;+navigator.appName+navigator.appVersion+&quot; browser.&quot;)
&lt;/&lt;I&gt;script&lt;/I&gt;&gt;


4.去除IE混動條:
&lt;body scroll=&quot;no&quot;&gt;
&lt;body style=&quot;overflow-y:hidden&quot;&gt;


5.進入網站,跳出廣告:
&lt;&lt;I&gt;script&lt;/I&gt; language=&quot;Java&lt;I&gt;script&lt;/I&gt;&quot;&gt;
&lt;!--
&lt;!-- 注意更改文件所在路徑--&gt;
&lt;I&gt;window&lt;/I&gt;.open(''http://www.XXXXXX.com'','''',''height=200,width=300,top=0,left=30'');
// --&gt;
&lt;/&lt;I&gt;script&lt;/I&gt;&gt;


6.隨機數:
&lt;%randomize%&gt;
&lt;%=(int(rnd()*n)+1)%&gt;
N為可改變數


7.向上混動代碼:
&lt;marquee direction=&quot;up&quot; scrolldelay=&quot;200&quot; style=&quot;font-size: 9pt; color: #FF0000; line-height: 150%; font-style:italic; font-weight:bold&quot; scrollamount=&quot;2&quot; width=&quot;206&quot; height=&quot;207&quot; bgcolor=&quot;#FFFF00&quot;&gt;hhhhhhhhhhhhhhhhhhh&lt;/marquee&gt;


8.自動關閉網頁:
&lt;&lt;I&gt;script&lt;/I&gt; LANGUAGE=&quot;Java&lt;I&gt;script&lt;/I&gt;&quot;&gt;
&lt;!--
setTimeout(''&lt;I&gt;window&lt;/I&gt;.close();'', 10000); //60秒後關閉
// --&gt;
&lt;/&lt;I&gt;script&lt;/I&gt;&gt;
&lt;p align=&quot;center&quot;&gt;本頁10秒後自動關閉,請注意刷新頁面&lt;/p&gt;


9.隨機背景音樂:
&lt;%randomize%&gt;
&lt;bgsound src=&quot;mids/&lt;%=(int(rnd()*60)+1)%&gt;.mid&quot; loop=&quot;-1&quot;&gt;


可以修改數字,限制調用個數,我這裡是60個.


10.自動刷新本頁面:
&lt;&lt;I&gt;script&lt;/I&gt;&gt;
&lt;!--


&lt;I&gt;var&lt;/I&gt; limit=&quot;0:10&quot;


if (document.images){
&lt;I&gt;var&lt;/I&gt; parselimit=limit.split(&quot;:&quot;)
parselimit=parselimit[0]*60+parselimit[1]*1
}
&lt;I&gt;function&lt;/I&gt; beginrefresh(){
if (!document.images)
return
if (parselimit==1)
&lt;I&gt;window&lt;/I&gt;.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+&quot;分&quot;+cursec+&quot;秒後重刷本頁!&quot;
else
curtime=cursec+&quot;秒後重刷本頁!&quot;
&lt;I&gt;window&lt;/I&gt;.status=curtime
setTimeout(&quot;beginrefresh()&quot;,1000)
}
}


&lt;I&gt;window&lt;/I&gt;.&lt;I&gt;onload&lt;/I&gt;=beginrefresh
&lt;I&gt;file:&lt;/I&gt;//--&gt;
&lt;/&lt;I&gt;script&lt;/I&gt;&gt;


11.ACCESS數據庫連接:
&lt;%
option explicit
dim startime,endtime,conn,connstr,db
startime=timer()
&prime;更改數據庫名字
db=&quot;data/dvBBS5.mdb&quot;
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
connstr=&quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; &amp; Server.MapPath(db)
&prime;如果你的服務器採用較老版本Access驅動,請用下面連接方法
&prime;connstr=&quot;driver={Microsoft Access Driver (*.mdb)};dbq=&quot; &amp; Server.MapPath(db)
conn.Open connstr
&lt;I&gt;function&lt;/I&gt; CloseDatabase
Conn.close
Set conn = Nothing
End &lt;I&gt;function&lt;/I&gt;
%&gt;


12.SQL數據庫連接:
&lt;%
option explicit
dim startime,endtime,conn,connstr,db
startime=timer()
connstr=&quot;driver={SQL Server};server=HUDENQ-N11T33NB;uid=sa;pwd=xsfeihu;database=dvbbs&quot;
Set conn = Server.CreateObject(&quot;ADODB.Connection&quot;)
conn.Open connstr
&lt;I&gt;function&lt;/I&gt; CloseDatabase
Conn.close
Set conn = Nothing
End &lt;I&gt;function&lt;/I&gt;
%&gt;


13.用鍵盤打開網頁代碼:
&lt;&lt;I&gt;script&lt;/I&gt; language=&quot;java&lt;I&gt;script&lt;/I&gt;&quot;&gt;
&lt;I&gt;function&lt;/I&gt; ctlent(eventobject)
{
  if((event.ctrlKey &amp;&amp; &lt;I&gt;window&lt;/I&gt;.event.keyCode==13)||(event.altKey &amp;&amp; &lt;I&gt;window&lt;/I&gt;.event.keyCode==83))
  {
    &lt;I&gt;window&lt;/I&gt;.open(&prime;網址&prime;,&prime;&prime;,&prime;&prime;)
  }
}
&lt;/&lt;I&gt;script&lt;/I&gt;&gt;


這裡是Ctrl+Enter和Alt+S的代碼 自己查下鍵盤的ASCII碼再換就行


14.讓層不被控件覆蓋代碼:
&lt;div z-Index:2&gt;&lt;object xxx&gt;&lt;/object&gt;&lt;/div&gt; # 前面
&lt;div z-Index:1&gt;&lt;object xxx&gt;&lt;/object&gt;&lt;/div&gt; # 後面
&lt;div id=&quot;Layer2&quot; style=&quot;position:absolute; top:40;width:400px; height:95px;z-index:2&quot;&gt;&lt;table height=100% width=100% bgcolor=&quot;#ff0000&quot;&gt;&lt;tr&gt;&lt;td height=100% width=100%&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&lt;&lt;I&gt;iframe&lt;/I&gt; width=0 height=0&gt;&lt;/&lt;I&gt;iframe&lt;/I&gt;&gt;&lt;/div&gt;
&lt;div id=&quot;Layer1&quot; style=&quot;position:absolute; top:50;width:200px; height:115px;z-index:1&quot;&gt;&lt;&lt;I&gt;iframe&lt;/I&gt; height=100% width=100%&gt;&lt;/&lt;I&gt;iframe&lt;/I&gt;&gt;&lt;/div&gt;


15.動網FLASH廣告代碼:
&lt;object classid=&quot;clsid:D27CDB6E-AE6D-11cf-96B8-444553540000&quot; codebase=&quot;http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0&quot; width=&quot;468&quot; height=&quot;60&quot;&gt;&lt;param name=movie value=&quot;images/yj16d.swf&quot;&gt;&lt;param name=quality value=high&gt;&lt;embed src=&quot;images/dvbanner.swf&quot; quality=high pluginspage=&quot;http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash&quot;;; type=&quot;application/x-shockwave-flash&quot; width=&quot;468&quot; height=&quot;60&quot;&gt;&lt;/embed&gt;&lt;/object&gt;


16.VBS彈出窗口小代碼:
&lt;&lt;I&gt;script&lt;/I&gt; language=vb&lt;I&gt;script&lt;/I&gt;&gt;
msgbox&quot;你還沒有註冊或登陸論壇&quot;,&quot;0&quot;,&quot;精品論壇&quot;
location.href = &quot;login.asp&quot;
&lt;/&lt;I&gt;script&lt;/I&gt;&gt;


16.使用FSO修改文件特定內容的函
&lt;I&gt;function&lt;/I&gt; FSOchange(filename,Target,String)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject(&quot;&lt;I&gt;script&lt;/I&gt;ing.FileSystemObject&quot;)
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FiletempData = objCountFile.ReadAll
objCountFile.Close
FiletempData=Replace(FiletempData,Target,String)
Set objCountFile=objFSO.CreateTextFile(Server.MapPath(filename),True)
objCountFile.Write FiletempData
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End &lt;I&gt;function&lt;/I&gt;


17.使用FSO讀取文件內容的函數
&lt;I&gt;function&lt;/I&gt; FSOFileRead(filename)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject(&quot;&lt;I&gt;script&lt;/I&gt;ing.FileSystemObject&quot;)
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FSOFileRead = objCountFile.ReadAll
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End &lt;I&gt;function&lt;/I&gt;


18.使用FSO讀取文件某一行的函數
&lt;I&gt;function&lt;/I&gt; FSOlinedit(filename,lineNum)
if linenum &lt; 1 then exit &lt;I&gt;function&lt;/I&gt;
dim fso,f,temparray,tempcnt
set fso = server.CreateObject(&quot;&lt;I&gt;script&lt;/I&gt;ing.filesystemobject&quot;)
if not fso.fileExists(server.mappath(filename)) then exit &lt;I&gt;function&lt;/I&gt;
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
set f = nothing
temparray = split(tempcnt,chr(13)&amp;chr(10))
if lineNum&gt;ubound(temparray)+1 then
  exit &lt;I&gt;function&lt;/I&gt;
else
  FSOlinedit = temparray(lineNum-1)
end if
end if
end &lt;I&gt;function&lt;/I&gt;


19.使用FSO寫文件某一行的函數
&lt;I&gt;function&lt;/I&gt; FSOlinewrite(filename,lineNum,Linecontent)
if linenum &lt; 1 then exit &lt;I&gt;function&lt;/I&gt;
dim fso,f,temparray,tempCnt
set fso = server.CreateObject(&quot;&lt;I&gt;script&lt;/I&gt;ing.filesystemobject&quot;)
if not fso.fileExists(server.mappath(filename)) then exit &lt;I&gt;function&lt;/I&gt;
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
temparray = split(tempcnt,chr(13)&amp;chr(10))
if lineNum&gt;ubound(temparray)+1 then
  exit &lt;I&gt;function&lt;/I&gt;
else
  temparray(lineNum-1) = lineContent
end if
tempcnt = join(temparray,chr(13)&amp;chr(10))
set f = fso.createtextfile(server.mappath(filename),true)
f.write tempcnt
end if
f.close
set f = nothing
end &lt;I&gt;function&lt;/I&gt;


20.使用FSO添加文件新行的函數
&lt;I&gt;function&lt;/I&gt; FSOappline(filename,Linecontent)
dim fso,f
set fso = server.CreateObject(&quot;&lt;I&gt;script&lt;/I&gt;ing.filesystemobject&quot;)
if not fso.fileExists(server.mappath(filename)) then exit &lt;I&gt;function&lt;/I&gt;
set f = fso.opentextfile(server.mappath(filename),8,1)
f.write chr(13)&amp;chr(10)&amp;Linecontent
f.close
set f = nothing
end &lt;I&gt;function&lt;/I&gt;

標籤:  target html asp

PJBlog-2.5-自動播放日誌中插入的影音檔案

下載ubbcode.asp
覆蓋原本common底下的ubbcode.asp
http://blog.nnickk.com/attachments/month_0604/220064206619.rar

使用範例
[ wmv=y ]xxxxx[ /wmv ]自動播放
[ wmv ]xxxxx[ /wmv ]手動播放

打散文字

style="word-break:break-all"
標籤:  html asp 程式 網頁
  • 1