|
今天找资料时找到这些东东,发在这里,希望对大家有所帮助:)
1.获得系统时间:
<%=now()%>
2.取得来访用的IP:
<%=request.serverVariables("remote_host")%>
3.获得系统,浏览器版本:
<script>
window.document.write("版本:"+navigator.appName+navigator.appVersion+" browser.")
</script>
4.去除IE混动条:
<body scroll="no">
<body style="overflow-y:hidden">
5.进入网站,跳出广告:
<script language="javascript">
<!--
<!-- 注意更改文件所在路径-->
window.open('' http://www.XXXXXX.com'','''',''height=200,width=300,top=0,left=30'');
// -->
</script>
6.随机数:
<%randomize%>
<%=(int(rnd()*n)+1)%>
N为可改变数
7.向上混动代码:
<marquee direction="up" scrolldelay="200" style="font-size: 9pt; color: #FF0000; line-height: 150%; font-style:italic; font-weight:bold" scrollamount="2" width="206" height="207" bgcolor="#FFFF00">hhhhhhhhhhhhhhhhhhh</marquee>
8.自动关闭网页:
<script LANGUAGE="javascript">
<!--
setTimeout(''window.close();'', 10000); //60秒后关闭
// -->
</script>
<p align="center">本页10秒后自动关闭,请注意刷新页面</p>
9.随机背景音乐:
<%randomize%>
<bgsound src="mids/<%=(int(rnd()*60)+1)%>.mid" loop="-1">
可以修改数字,限制调用个数,我这里是60个.
10.自动刷新本页面:
<script>
<!--
var limit="0:10"
if (document.images){
var parselimit=limit.split(":")
parselimit=parselimit[0]*60+parselimit[1]*1
}
function beginrefresh(){
if (!document.images)
return
if (parselimit==1)
window.location.reload()
else{
parselimit-=1
curmin=Math.floor(parselimit/60)
cursec=parselimit%60
if (curmin!=0)
curtime=curmin+"分"+cursec+"秒后重刷本页!"
else
curtime=cursec+"秒后重刷本页!"
window.status=curtime
setTimeout("beginrefresh()",1000)
}
}
window.onload=beginrefresh
file://-->
</script>
11.ACCESS数据库连接:
<%
option explicit
dim startime,endtime,conn,connstr,db
startime=timer()
'更改数据库名字
db="data/dvBBS5.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="rovider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
'如果你的服务器采用较老版本Access驱动,请用下面连接方法
'connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(db)
conn.Open connstr
function CloseDatabase
Conn.close
Set conn = Nothing
End Function
%>
12.SQL数据库连接:
<%
option explicit
dim startime,endtime,conn,connstr,db
startime=timer()
connstr="driver={SQL Server};server=HUDENQ-N11T33NB;uid=sa;pwd=xsfeihu;database=dvbbs"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open connstr
function CloseDatabase
Conn.close
Set conn = Nothing
End Function
%>
13.用键盘打开网页代码:
<script language="javascript">
function ctlent(eventobject)
{
if((event.ctrlKey && window.event.keyCode==13)||(event.altKey && window.event.keyCode==83))
{
window.open('网址','','')
}
}
</script>
14.让层不被控件复盖代码:
<div z-Index:2><object xxx></object></div> # 前面
<div z-Index:1><object xxx></object></div> # 后面
<div id="Layer2" style="position:absolute; top:40;width:400px; height:95px;z-index:2"><table height=100% width=100% bgcolor="#ff0000"><tr><td height=100% width=100%></td></tr></table><iframe width=0 height=0></iframe></div>
<div id="Layer1" style="position:absolute; top:50;width:200px; height:115px;z-index:1"><iframe height=100% width=100%></iframe></div>
15.动网FLASH广告代码:
<object classid="clsid27CDB6E-AE6D-11cf-96B8-444553540000" codebase=" http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="468" height="60"><param name=movie value="images/yj16d.swf"><param name=quality value=high><embed src="images/dvbanner.swf" quality=high pluginspage=" http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash";; type="application/x-shockwave-flash" width="468" height="60"></embed></object>
16.VBS弹出窗口小代码:
<script language=vbscript>
msgbox"你还没有注册或登陆论坛","0","精品论坛"
location.href = "login.asp"
</script>
16.使用FSO修改文件特定内容的函数
function FSOchange(filename,Target,String)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
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 Function
17.使用FSO读取文件内容的函数
function FSOFileRead(filename)
Dim objFSO,objCountFile,FiletempData
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objCountFile = objFSO.OpenTextFile(Server.MapPath(filename),1,True)
FSOFileRead = objCountFile.ReadAll
objCountFile.Close
Set objCountFile=Nothing
Set objFSO = Nothing
End Function
18.使用FSO读取文件某一行的函数
function FSOlinedit(filename,lineNum)
if linenum < 1 then exit function
dim fso,f,temparray,tempcnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
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)&chr(10))
if lineNum>ubound(temparray)+1 then
exit function
else
FSOlinedit = temparray(lineNum-1)
end if
end if
end function
19.使用FSO写文件某一行的函数
function FSOlinewrite(filename,lineNum,Linecontent)
if linenum < 1 then exit function
dim fso,f,temparray,tempCnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),1)
if not f.AtEndofStream then
tempcnt = f.readall
f.close
temparray = split(tempcnt,chr(13)&chr(10))
if lineNum>ubound(temparray)+1 then
exit function
else
temparray(lineNum-1) = lineContent
end if
tempcnt = join(temparray,chr(13)&chr(10))
set f = fso.createtextfile(server.mappath(filename),true)
f.write tempcnt
end if
f.close
set f = nothing
end function
20.使用FSO添加文件新行的函数
function FSOappline(filename,Linecontent)
dim fso,f
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
set f = fso.opentextfile(server.mappath(filename),8,1)
f.write chr(13)&chr(10)&Linecontent
f.close
set f = nothing
end function
21.读文件最后一行的函数
function FSOlastline(filename)
dim fso,f,temparray,tempcnt
set fso = server.CreateObject("scripting.filesystemobject")
if not fso.fileExists(server.mappath(filename)) then exit function
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)&chr(10))
FSOlastline = temparray(ubound(temparray))
end if
end function
[推荐]利用FSO取得BMP,JPG,PNG,GIF文件信息(大小,宽、高等)
<%
'::: BMP, GIF, JPG and PNG :::
'::: This function gets a specified number of bytes from any :::
'::: file, starting at the offset (base 1) :::
'::: :::
'::: Passed: :::
'::: flnm => Filespec of file to read :::
'::: offset => Offset at which to start reading :::
'::: bytes => How many bytes to read :::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function GetBytes(flnm, offset, bytes)
Dim objFSO
Dim objFTemp
Dim objTextStream
Dim lngSize
on error resume next
Set objFSO = CreateObject("Scripting.FileSystemObject")
' First, we get the filesize
Set objFTemp = objFSO.GetFile(flnm)
lngSize = objFTemp.Size
set objFTemp = nothing
fsoForReading = 1
Set objTextStream = objFSO.OpenTextFile(flnm, fsoForReading)
if offset > 0 then
strBuff = objTextStream.Read(offset - 1)
end if
if bytes = -1 then ' Get All!
GetBytes = objTextStream.Read(lngSize) 'ReadAll
else
GetBytes = objTextStream.Read(bytes)
end if
objTextStream.Close
set objTextStream = nothing
set objFSO = nothing
end function
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
'::: Functions to convert two bytes to a numeric value (long) :::
'::: (both little-endian and big-endian) :::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function lngConvert(strTemp)
lngConvert = clng(asc(left(strTemp, 1)) + ((asc(right(strTemp, 1)) * 256)))
end function
function lngConvert2(strTemp)
lngConvert2 = clng(asc(right(strTemp, 1)) + ((asc(left(strTemp, 1)) * 256)))
end function
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: :::
'::: This function does most of the real work. It will attempt :::
'::: to read any file, regardless of the extension, and will :::
'::: identify if it is a graphical image. :::
'::: :::
'::: Passed: :::
'::: flnm => Filespec of file to read :::
'::: width => width of image :::
'::: height => height of image :::
'::: depth => color depth (in number of colors) :::
'::: strImageType=> type of image (e.g. GIF, BMP, etc.) :::
'::: :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
function gfxSpex(flnm, width, height, depth, strImageType)
dim strPNG
dim strGIF
dim strBMP
dim strType
strType = ""
strImageType = "(unknown)"
gfxSpex = False
strPNG = chr(137) & chr(80) & chr(78)
strGIF = "GIF"
strBMP = chr(66) & chr(77)
strType = GetBytes(flnm, 0, 3)
if strType = strGIF then ' is GIF
strImageType = "GIF"
Width = lngConvert(GetBytes(flnm, 7, 2))
Height = lngConvert(GetBytes(flnm, 9, 2))
Depth = 2 ^ ((asc(GetBytes(flnm, 11, 1)) and 7) + 1)
gfxSpex = True
elseif left(strType, 2) = strBMP then ' is BMP
strImageType = "BMP"
Width = lngConvert(GetBytes(flnm, 19, 2))
Height = lngConvert(GetBytes(flnm, 23, 2))
Depth = 2 ^ (asc(GetBytes(flnm, 29, 1)))
gfxSpex = True
elseif strType = strPNG then ' Is PNG
strImageType = "NG"
Width = lngConvert2(GetBytes(flnm, 19, 2))
Height = lngConvert2(GetBytes(flnm, 23, 2))
Depth = getBytes(flnm, 25, 2)
select case asc(right(Depth,1))
case 0
Depth = 2 ^ (asc(left(Depth, 1)))
gfxSpex = True
case 2
Depth = 2 ^ (asc(left(Depth, 1)) * 3)
gfxSpex = True
case 3
Depth = 2 ^ (asc(left(Depth, 1))) '8
gfxSpex = True
case 4
Depth = 2 ^ (asc(left(Depth, 1)) * 2)
gfxSpex = True
case 6
Depth = 2 ^ (asc(left(Depth, 1)) * 4)
gfxSpex = True
case else
Depth = -1
end select
else
strBuff = GetBytes(flnm, 0, -1) ' Get all bytes from file
lngSize = len(strBuff)
flgFound = 0
strTarget = chr(255) & chr(216) & chr(255)
flgFound = instr(strBuff, strTarget)
if flgFound = 0 then
exit function
end if
strImageType = "JPG"
lngPos = flgFound + 2
ExitLoop = false
do while ExitLoop = False and lngPos < lngSize
do while asc(mid(strBuff, lngPos, 1)) = 255 and lngPos < lngSize
lngPos = lngPos + 1
loop
if asc(mid(strBuff, lngPos, 1)) < 192 or asc(mid(strBuff, lngPos, 1)) > 195 then
lngMarkerSize = lngConvert2(mid(strBuff, lngPos + 1, 2))
lngPos = lngPos + lngMarkerSize + 1
else
ExitLoop = True
end if
loop
'
if ExitLoop = False then
Width = -1
Height = -1
Depth = -1
else
Height = lngConvert2(mid(strBuff, lngPos + 4, 2))
Width = lngConvert2(mid(strBuff, lngPos + 6, 2))
Depth = 2 ^ (asc(mid(strBuff, lngPos + 8, 1)) * 8)
gfxSpex = True
end if
end if
end function
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
'::: Test Harness :::
':::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
' To test, we'll just try to show all files with a .GIF extension in the root of C:
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objF = objFSO.GetFolder("c:\")
Set objFC = objF.Files
response.write "<table border=""0"" cellpadding=""5"">"
For Each f1 in objFC
if instr(ucase(f1.Name), ".GIF") then
response.write "<tr><td>" & f1.name & "</td><td>" & f1.DateCreated & "</td><td>" & f1.Size & "</td><td>"
if gfxSpex(f1.Path, w, h, c, strType) = true then
response.write w & " x " & h & " " & c & " colors"
else
response.write " "
end if
response.write "</td></tr>"
end if
Next
response.write "</table>"
set objFC = nothing
set objF = nothing
set objFSO = nothing
%>
24.点击返回上页代码:
<form>
<p><input TYPE="button" value="返回上一步" onCLICK="history.back(-1)"></p>
</form>
24.点击刷新代码:
<form>
<p><input TYPE="button" value="刷新按钮一" onCLICK="ReloadButton()"></p>
</form>
<script language="javascript"><!--
function ReloadButton(){location.href="allbutton.htm";}
// --></script>
24.点击刷新代码2:
<form>
<p><input TYPE="button" value="刷新按钮二" onClick="history.go(0)"> </p>
</form>
<form>
<p><input TYPE="button" value="打开一个网站" onCLICK="HomeButton()"></p>
</form>
<script language="javascript"><!--
function HomeButton(){location.href=" http://nettrain.126.com";;}
// --></script>
25.弹出警告框代码:
<form>
<p><input TYPE="button" value="弹出警告框" onCLICK="AlertButton()"></p>
</form>
<script language="javascript"><!--
function AlertButton(){window.alert("要多多光临呀!");}
// --></script>
26.状态栏信息
<form>
<p><input TYPE="button" value="状态栏信息" onCLICK="StatusButton()"></p>
</form>
<script language="javascript"><!--
function StatusButton(){window.status="要多多光临呀!";}
// --></script>
27.背景色变换
<form>
<p><input TYPE="button" value="背景色变换" onClick="BgButton()"></p>
</form>
<script>function BgButton(){
if (document.bgColor=='#00ffff')
{document.bgColor='#ffffff';}
else{document.bgColor='#00ffff';}
}
</script>
28.点击打开新窗口
<form>
<p><input TYPE="button" value="打开新窗口" onCLICK="NewWindow()"></p>
</form>
<script language="javascript"><!--
function NewWindow(){window.open(" http://www.mcmx.com";,"","height=240,width=340,status=no,location=no,toolbar=no,directories=no,menubar=no");}
// --></script></body>
29.分页代码:
<%''本程序文件名为:Pages.asp%>
<%''包含ADO常量表文件adovbs.inc,可从"\Program Files\Common Files\System\ADO"目录下拷贝%>
<!--#Include File="adovbs.inc"-->
<%''*建立数据库连接,这里是Oracle8.05数据库
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "rovider=msdaora.1;Data Source=YourSrcName;User ID=YourUserID;Password=YourPassword;"
Set rs=Server.CreateObject("ADODB.Recordset") ''创建Recordset对象
rs.CursorLocation=adUseClient ''设定记录集指针属性
''*设定一页内的记录总数,可根据需要进行调整
rs.PageSize=10
''*设置查询语句
StrSQL="Select ID,姓名,住址,电话 from 通讯录 Order By ID"
rs.Open StrSQL,conn,adOpenStatic,adLockReadOnly,adCmdText
%>
<HTML>
<HEAD>
<title>分页示例</title>
<script language=javascript>
//点击"[第一页]"时响应:
function PageFirst()
{
document.MyForm.CurrentPage.selectedIndex=0;
document.MyForm.CurrentPage.onchange();
}
//点击"[上一页]"时响应:
function PagePrior()
{
document.MyForm.CurrentPage.selectedIndex--;
document.MyForm.CurrentPage.onchange();
}
//点击"[下一页]"时响应:
function PageNext()
{
document.MyForm.CurrentPage.selectedIndex++;
document.MyForm.CurrentPage.onchange();
}
//点击"[最后一页]"时响应:
function PageLast()
{
document.MyForm.CurrentPage.selectedIndex=document.MyForm.CurrentPage.length-1;
document.MyForm.CurrentPage.onchange();
}
//选择"第?页"时响应:
function PageCurrent()
{ //Pages.asp是本程序的文件名
document.MyForm.action='Pages.asp?Page='+(document.MyForm.CurrentPage.selectedIndex+1)
document.MyForm.submit();
}
</Script>
</HEAD>
<BODY bgcolor="#ffffcc" link="#008000" vlink="#008000" alink="#FF0000"">
<%IF rs.Eof THEN
Response.Write("<font size=2 color=#000080>[数据库中没有记录!]</font>")
ELSE
''指定当前页码
If Request("CurrentPage")="" Then
rs.AbsolutePage=1
Else
rs.AbsolutePage=CLng(Request("CurrentPage"))
End If
''创建表单MyForm,方法为Get
Response.Write("<form method=Get name=MyForm>")
Response.Write("<p align=center><font size=2 color=#008000>")
''设置翻页超链接
if rs.PageCount=1 then
Response.Write("[第一页] [上一页] [下一页] [最后一页] ")
else
if rs.AbsolutePage=1 then
Response.Write("[第一页] [上一页] ")
Response.Write("[<a href=javascriptageNext()>下一页</a>] ")
Response.Write("[<a href=javascriptageLast()>最后一页</a>] ")
else
if rs.AbsolutePage=rs.PageCount then
Response.Write("[<a href=javascriptageFirst()>第一页</a>] ")
Response.Write("[<a href=javascript:PagePrior()>上一页</a>] ")
Response.Write("[下一页] [最后一页] ")
else
Response.Write("[<a href=javascript:PageFirst()>第一页</a>] ")
Response.Write("[<a href=javascript:PagePrior()>上一页</a>] ")
Response.Write("[<a href=javascript:PageNext()>下一页</a>] ")
Response.Write("[<a href=javascript:PageLast()>最后一页</a>] ")
end if
end if
end if
''创建下拉列表框,用于选择浏览页码
Response.Write("第<select size=1 name=CurrentPage onchange=PageCurrent()>")
For i=1 to rs.PageCount
if rs.AbsolutePage=i then
Response.Write("<option selected>"&i&"</option>") ''当前页码
else
Response.Write("<option>"&i&"</option>")
end if
Next
Response.Write("</select>页/共"&rs.PageCount&"页 共"&rs.RecordCount&"条记录</font><p>")
Response.Write("</form>")
''创建表格,用于显示
Response.Write("<table align=center cellspacing=1 cellpadding=1 border=1")
Response.Write(" bordercolor=#99CCFF bordercolordark=#b0e0e6 bordercolorlight=#000066>")
Response.Write("<tr bgcolor=#ccccff bordercolor=#000066>")
Set Columns=rs.Fields
''显示表头
For i=0 to Columns.Count-1
Response.Write("<td align=center width=200 height=13>")
Response.Write("<font size=2><b>"&Columns(i).name&"</b></font></td>")
Next
Response.Write("</tr>")
''显示内容
For i=1 to rs.PageSize
Response.Write("<tr bgcolor=#99ccff bordercolor=#000066>")
For j=0 to Columns.Count-1
Response.Write("<td><font size=2>"&Columns(j)&"</font></td>")
Next
Response.Write("</tr>")
rs.movenext
if rs.EOF then exit for
Next
Response.Write("</table>")
END IF
%>
</BODY>
</HTML>
验证合法EMAIL地址:
function IsValidEmail(email)
dim names, name, i, c
IsValidEmail = true
names = Split(email, "@")
if UBound(names) <> 1 then
IsValidEmail = false
exit function
end if
for each name in names
if Len(name) <= 0 then
IsValidEmail = false
exit function
end if
for i = 1 to Len(name)
c = Lcase(Mid(name, i, 1))
if InStr("abcdefghijklmnopqrstuvwxyz_-.", c) <= 0 and not IsNumeric(c) then
IsValidEmail = false
exit function
end if
next
if Left(name, 1) = "." or Right(name, 1) = "." then
IsValidEmail = false
exit function
end if
next
if InStr(names(1), ".") <= 0 then
IsValidEmail = false
exit function
end if
i = Len(names(1)) - InStrRev(names(1), ".")
if i <> 2 and i <> 3 then
IsValidEmail = false
exit function
end if
if InStr(email, "..") > 0 then
IsValidEmail = false
end if
end function
Windows Media Player 播放器
<OBJECT id=MediaPlayer1
style="LEFT: 0px; VISIBILITY: visible; POSITION: absolute; TOP: 0px;z-index:2"
codeBase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701standby=
Loading
type=application/x-oleobject height=300 width=320
classid=CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6 VIEWASTEXT>
<PARAM NAME="URL" value="地址">
<param name="AudioStream" value="-1">
<param name="AutoSize" value="0">
<param name="AutoStart" value="-1">
<param name="AnimationAtStart" value="0">
<param name="AllowScan" value="-1">
<param name="AllowChangeDisplaySize" value="-1">
<param name="AutoRewind" value="0">
<param name="Balance" value="0">
<param name="BaseURL" value>
<param name="BufferingTime" value="5">
<param name="CaptioningID" value>
<param name="ClickToPlay" value="-1">
<param name="CursorType" value="0">
<param name="CurrentPosition" value="-1">
<param name="CurrentMarker" value="0">
<param name="DefaultFrame" value>
<param name="DisplayBackColor" value="0">
<param name="DisplayForeColor" value="16777215">
<param name="DisplayMode" value="0">
<param name="DisplaySize" value="4">
<param name="Enabled" value="-1">
<param name="EnableContextMenu" value="-1">
<param name="EnablePositionControls" value="0">
<param name="EnableFullScreenControls" value="0">
<param name="EnableTracker" value="-1">
<param name="InvokeURLs" value="-1">
<param name="Language" value="-1">
<param name="Mute" value="0">
<param name="PlayCount" value="1">
<param name="PreviewMode" value="0">
<param name="Rate" value="1">
<param name="SAMILang" value>
<param name="SAMIStyle" value>
<param name="SAMIFileName" value>
<param name="SelectionStart" value="-1">
<param name="SelectionEnd" value="-1">
<param name="SendOpenStateChangeEvents" value="-1">
<param name="SendWarningEvents" value="-1">
<param name="SendErrorEvents" value="-1">
<param name="SendKeyboardEvents" value="0">
<param name="SendMouseClickEvents" value="0">
<param name="SendMouseMoveEvents" value="0">
<param name="SendPlayStateChangeEvents" value="-1">
<param name="ShowCaptioning" value="0">
<param name="ShowControls" value="-1">
<param name="ShowAudioControls" value="-1">
<param name="ShowDisplay" value="0">
<param name="ShowGotoBar" value="0">
<param name="ShowPositionControls" value="-1">
<param name="ShowStatusBar" value="-1">
<param name="ShowTracker" value="-1">
<param name="TransparentAtStart" value="-1">
<param name="VideoBorderWidth" value="0">
<param name="VideoBorderColor" value="0">
<param name="VideoBorder3D" value="0">
<param name="Volume" value="70">
<param name="WindowlessVideo" value="0">
</OBJECT>
RealPlayer 播放器
<object id=video1 classid=" clasid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA"
width=320 height=240 align="middle">
<param name="controls" value="inagewindow">
<param name="console" value="chicp1">
<param name="autostar" value="true">
<param name="src" value="地址">
<embed
src="地址"
type="audio/x-pn-realaudio-plugin" console="chip1"
controls="imagewindow" width=320 height=240 autostart=true align="middle">
</embed>
</object>
<script LANGUAGE="VBSCRIPT">
a=msgbox("真的要删除该记录吗?",1,"注意")
if a=1 then
location="Dodelete.asp?id=<%=id%>" //指向执行删除的页面Dodelete.asp
else
history.go(-1)
end if
</script>
其中id=<%=id%>是指从表单中取得的数据编号,当然也可以是其他的东东。
ASP打印
var strFeature="height=360,width=500,status=no,toolbar=no,resizable=no,menubar=no,location=no";
var aWin = window.open("","Print",strFeature);
aWin.document.open();
aWin.document.write("<html>");
aWin.document.write("<head>");
aWin.document.write("<title>打印服务</title>");
aWin.document.write("</head>");
aWin.document.write("<BODY onload='window.print();window.close();'>");
aWin.document.write("<IMG src=" + document.MVIMAGE.src +">");
aWin.document.write("<font size='0'>");
aWin.document.write("<BR><BR>版权所有 郑州达维计算机技术有限公司</a> ");
aWin.document.write(" http://www.zzdw.com";;);
aWin.document.write("</font>");
aWin.document.write("</BODY>");
aWin.document.write("</html>");
aWin.document.close();
输入框加背景色<input style='background-color:Red'>在加入type="xxx"可以为其它的控件加入背景颜色。
下拉菜单变背景色
<select name="select">
<option style="background-color:#f0f0f0">111111111</option>
<option style="background-color:#cccccc">111111111</option>
</select>
两个下拉表单相互关联
<form name="doublecombo">
<select name="example" size="1" onChange="redirect(this.options.selectedIndex)">
<option>阳光在线</option>
<option> www.sunness.com</option>
<option>sunness.com</option>
</select>
<select name="stage2" size="1">
<option value=" http://www.80cn.com";;>阳光在线</option>
</select>
<input type="button" name="test" value="Go!"
onClick="go()">
</p>
<script>
<!--
var groups=document.doublecombo.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group=new Array()
group[0][0]=new Option("阳光在线"," http://www.sunness.com";;)
group[1][0]=new Option("阳光在线"," http://www.sunness.com";;)
group[1][1]=new Option("sunness"," http://www.sunness.com";;)
group[1][2]=new Option("sunness.com"," http://www.sunness.com";;)
group[2][0]=new Option("aaat"," http://www.sunness.com";;)
group[2][1]=new Option("bbb"," http://www.sunness.com";;)
group[2][2]=new Option("ddd"," http://www.sunness.com";;)
group[2][3]=new Option("ccc"," http://www.sunness.com";;)
var temp=document.doublecombo.stage2
function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options=new Option(group[x].text,group[x].value)
}
temp.options[0].selected=true
}
function go(){
location=temp.options[temp.selectedIndex].value
}
//-->
</script>
</form>
1. 如何在网页中加入注释
◆代码:< !-- 这是注释 -->
2. 如何在网页中加入EMAIL链接并显示预定的主题
◆代码:< a href="mailto:yourmail@xxx.xxx?Subject=你好">Send Mail< /a>
3. 如何制作电子邮件表单
◆在<FORM>中输入Action="youremail@XXX.XXX" ,提交采用POST方法。
4. 如何避免别人将你的网页放入他的框架(FRAME)中
◆在源代码中的<HEAD>…< /HEAD>之间加入如下代码:
<s cript language="javas cript"><!--
if (self!=top){top.location=self.location;}
-->< /s cript>
5. 如何自动加入最后修改日期
◆在源代码中的<BODY>…< /BODY>之间加入如下代码:
< s cript Language="Javas cript"><!--
document.write("Last Updated:"+document.lastModified);
-->< /s cript>
6. 如何让背景图象不滚动
◆代码:<BODY Background="bg.gif" Bgproperties="fixed" >
◆在Dreamweaver中用「Text」-「Custom Style」-「Edit Style Sheet」-「New」-Redefine HTML Tag中选择Body,然后在Background中的Attachment里选fixed
7. 如何将网页定时关闭
◆在源代码中的<BODY>后面加入如下代码:
< s cript LANGUAGE="Javas cript"> <!--
setTimeout('window.close();', 60000);
--> < /s cript>
在代码中的60000表示1分钟,它是以毫秒为单位的。
8. 将网页加入收藏夹
◆请使用如下代码:(注意标点符号)
< a href='#' onclick="window.external.addFavorite(' http://qiangwei.126.com','【梦想天空】qiangwei.126.com 各种网页工具教程DW、FLASH、FIREWORKS及CGI教学、聊天交友……')" target="_top">将本站加入收藏夹< /a>
9. 如何定义网页的关键字(KeyWords)
◆格式如下:
< meta name="keywords" content="dreamweaver,flash,fireworks">
content中的即为关键字,用逗号隔开
◆在Dreamweaver中用「Insert」-「Head」-KeyWords命令
10. 如何设置命令来关闭打开的窗口
◆在源代码中加入如下代码:
< a href="/" onclick="javas cript:window.close(); return false;">关闭窗口< /a>
11. 如何在网页中加入书签,在页面内任意跳转
◆在源代码中需要插入书签的地方输入,在调用的地方输入Top,其中的top是你设定的书签名字。
◆在Dreamweaver中用菜单的「Insert」-「Name Anchor」命令插入书签,调用时,在Link中输入#top,top为书签名。
12. 如何为不支持框架的浏览器指定内容
◆在源代码中加入下面代码:
< BODY><noframes>本网页有框架结构,请下载新的浏览器观看< /noframes></ BODY>
13. 如何在网页中加入单个或几个空格
◆在源代码中输入 ,每个 之间请用空格分开。
◆在Dreamweaver中用<CTRL>+<SHIFT>+<SPACE>插入空格或任输几个字符,然后将其色彩设成背景的色彩!
14. 如何在网页中加入书签,在多个页面之间任意跳转
◆方法与上面类似,不过做链接时要在书签名前加上网页文件名,如:other.htm#top,这样一来就会跳转到other.htm页面中的top书签处。
15. 如何使表格(TABLE)没有边框线
◆将表格的边框属性:border="0"
16. 如何隐藏状态栏里出现的LINK信息
◆请使用如下代码:
< a href=" http://qiangwei.126.com";; onMouseOver="window.status='none';return true">梦想天空< /a>
17. 如何定时载入另一个网页内容
◆在源代码中的<HEAD>…< /HEAD> 加入如下代码:
< meta http-equiv="refresh" content="40;URL=http://qiangwei.126.com">
40秒后将自动 http://qiangwei.126.com所在的网页
18. 如何为网页设置背景音乐
◆代码:< EMBED src="music.mid" autostart="true" loop="2" width="80" height="30" >
src:音乐文件的路径及文件名;
autostart:true为音乐文件上传完后自动开始播放,默认为false(否)
loop:true为无限次重播,false为不重播,某一具体值(整数)为重播多少次
volume:取值范围为"0-100",设置音量,默认为系统本身的音量
starttime:"分:秒",设置歌曲开始播放的时间,如,starttime="00:10",从第10开始播放
endtime: "分:秒",设置歌曲结束播放的时间
width:控制面板的宽
height:控制面板的高
controls:控制面板的外观
controls="console/smallconsole/playbutton/pausebutton/stopbutton/volumelever"
console:正常大小的面板
smallconsole:较小的面板
playbutton:显示播放按钮
pausebutton:显示暂停按钮
stopbutton:显示停止按钮
volumelever:显示音量调节按钮
hidden:为true时可以隐藏面板
19. 如何去掉链接的下划线
◆在源代码中的<HEAD>…</HEAD>之间输入如下代码:
<style type="text/css"> <!--
a { text-decoration: none}
--> < /style>
◆在Dreamweaver中用「Text」-「Custom Style」-「Edit Style Sheet」-「New」-Redefine HTML Tag中选择a,然后在decoration中选中none
20. timeline中的layer走曲线
◆要使得timeline中的layer走曲线,你得先让他走出直线来,然后在最后一frame和第一frame中间的任何一frame上点右键,可以看到有个 add keyframe ,点一下,然后把你的layer移动到你要的位置,dw会自动生成曲线,good luck !
|
|