[Web樣式/腳本/標籤收藏]

無提示關閉窗口
<input type="button" onClick="window.opener = 'xxx';window.close();" value="IE6最簡單的無提示關閉窗口" >

javascript 預裝載圖片
<script language="JavaScript">
var img = new Image();
img.src = "http://community.csdn.net/images/CSDN_logo.GIF";
</script>
<body οnlοad="javascript:img1.src=img.src">
<img id=img1>
</body>

文章列表中常用的顏色交替
<style>
tr{background-color:expression((this.rowIndex%2==0)?"blue":"red");ryo:expression(οnmοuseοver=function(){this.style.backgroundColor=(this.style.backgroundColor!='gray'?'gray':((this.rowIndex%2==0)?"blue":"red"))},οnmοuseοut=function(){this.style.backgroundColor=(this.style.backgroundColor!='gray'?'gray':((this.rowIndex%2==0)?"blue":"red"))})}
</style>
<TABLE width="200" cellpadding="0" cellspacing="2" border="0" id="t1">
<TR><TD>1</TD></TR>
<TR><TD>1</TD></TR>
<TR><TD>1</TD></TR>
<TR><TD>1</TD></TR>
<TR><TD>1</TD></TR>
<TR><TD>1</TD></TR>
<TR><TD>1</TD></TR>
<TR><TD>1</TD></TR>
</TABLE>

網頁倒過來
<style type="text/css">
<!--
body {filter:FlipH() FlipV();}
-->
</style>

修改任意WEB元素
<table id="test">
<tr>
<td>gfd</td>
<td>gfdgsfdgfs</td>
</tr>
</table>
<script language="javascript">
document.getElementById("test").outerHTML="<table><tr><td><img src='http://www.sina.com.cn/images/logo.gif'></td></tr></table>";
</script>

常用JS驗證
<script language=Vbscript>
Function IsVerify(patrn,strng)
strng=Trim(strng)
Select Case patrn
Case "User" '用戶名
patrn="^[a-z]{1}([a-z0-9]|[._]){2,19}$"
Case "Truename" '英文姓名
patrn="^[a-zA-Z]{1,30}$"
Case "Passwd" '密碼
patrn="^(/w){6,20}$"
Case "Tel" '電話/傳真
patrn="^[+]{0,1}(/d){1,3}[ ]?([-]?((/d)|[ ]){1,12})+$"
Case "Mobil" '手機
patrn="^(/d)+[-]?(/d){6,12}$"
Case "Date" '日期(格式:yyyy-mm-dd)
patrn="^[12]{1}(/d){3}[-][01]?(/d){1}[-][0123]?(/d){1}$"
Case "Email" '電子郵件
patrn="^((/w)|[-]|[.])+@(((/w)|[-])+[.])+[a-z]{2,4}$"
Case "Postalcode" '郵政編碼
patrn="^[a-z0-9 ]{3,12}$"
Case "Search" '搜索關鍵字
patrn="^[^`~!@#$%^&*()+=|///[/]/{/}:;/'/,.<>/?]{1}[^`~!@$%^&()+=|///[/]/{/}:;/'/,.<>?]{0,19}$"
Case "Int" '整數
patrn="^[1-9]{1}[0-9]{0,5}$"
Case "Array"
patrn="^[0-9]{1}([0-9]|[/,]){0,150}$"
End Select
Dim regEx
Dim Match
Set regEx = New RegExp
regEx.Pattern = patrn
regEx.IgnoreCase = True
regEx.Global = True
Matches = regEx.test(strng)
IsVerify = Matches
Set regEx = Nothing
End Function
</script>

onblur事件時調用IsVerify("Email",value)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章