特效代码集 收藏
滚动条
Code: [Copy to clipboard]
1.overflow内容溢出时的设置(设定被设定对象是否显示滚动条)
overflow-x水平方向内容溢出时的设置
overflow-y垂直方向内容溢出时的设置
以上三个属性设置的值为visible(默认值)、scroll、hidden、auto。
2.scrollbar-3d-light-color立体滚动条亮边的颜色(设置滚动条的颜色)
scrollbar-arrow-color上下按钮上三角箭头的颜色
scrollbar-base-color滚动条的基本颜色
scrollbar-dark-shadow-color立体滚动条强阴影的颜色
scrollbar-face-color立体滚动条凸出部分的颜色
scrollbar-highlight-color滚动条空白部分的颜色
scrollbar-shadow-color立体滚动条阴影的颜色
我们通过几个实例来讲解上述的样式属性:
1.让浏览器窗口永远都不出现滚动条
没有水平滚动条
〈body style="overflow-x:hidden"〉
没有垂直滚动条
〈body style="overflow-y:hidden"〉
没有滚动条
〈body style="overflow-x:hidden;;overflow-y:hidden"〉或〈body
style="overflow:hidden"〉
2.设定多行文本框的滚动条
没有水平滚动条
〈textarea style="overflow-x:hidden"〉〈/textarea〉
没有垂直滚动条
〈textarea style="overflow-y:hidden"〉〈/textarea〉
没有滚动条
〈textarea style="overflow-x:hidden;;overflow-y:hidden"〉〈/textarea〉
或〈textarea style="overflow:hidden"〉〈/textarea〉
3.设定窗口滚动条的颜色
设置窗口滚动条的颜色为红色〈body style="scrollbar-base-color:red"〉
scrollbar-base-color设定的是基本色,一般情况下只需要设置这一个属性就可以达到改变滚动条颜色的目的。
加上一点特别的效果:
〈body style="scrollbar-arrow-color:yellow;;scrollbar-base-color:lightsalmon"〉
4.在样式表文件中定义好一个类,调用样式表。
〈style〉
.coolscrollbar{scrollbar-arrow-color:yellow;;scrollbar-base-color:lightsalmon;;}
〈/style〉
这样调用:
〈textarea class="coolscrollbar"〉〈/textarea〉
无边框窗口代码
制作无边框页面的代码
Code: [Copy to clipboard]
//第一步:把如下代码加入〈head〉〈/head〉区域中
〈script language=javascript〉
minimizebar="minimize.gif";; //视窗右上角最小化「按钮」的图片
minimizebar2="minimize2.gif";; //滑鼠悬停时最小化「按钮」的图片
closebar="close.gif";; //视窗右上角关闭「按钮」的图片
closebar2="close2.gif";; //滑鼠悬停时关闭「按钮」的图片
icon="icon.gif";; //视窗左上角的小图标
function noBorderWin(fileName,w,h,titleBg,moveBg,titleColor,titleWord,scr) //定义一个弹出无边视窗的函数,能数意义见下面「参数说明」,实际使用见最後的实例。
/*
------------------参数说明-------------------
fileName :无边视窗中显示的文件。
w :视窗的宽度。
h :视窗的高度。
titleBg :视窗「标题栏」的背景色以及视窗边框颜色。
moveBg :视窗拖动时「标题栏」的背景色以及视窗边框颜色。
titleColor :视窗「标题栏」文字的颜色。
titleWord :视窗「标题栏」的文字。
scr :是否出现卷轴。取值yes/no或者1/0。
--------------------------------------------
*/
{
var contents="〈html〉"+
"〈head〉"+
"〈title〉"+titleWord+"〈/title〉"+
"〈META http-equiv=/"Content-Type/" content=/"text/html;; charset=gb2312/"〉"+
" 〈object id=hhctrl type='application/x-oleobject' classid='clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11'〉〈param name='Command' value='minimize'〉〈/object〉"+
"〈/head〉"+
"〈body topmargin=0 leftmargin=0 scroll=no onselectstart='return false' οndragstart='return false'〉"+
" 〈table height=100% width=100% cellpadding=0 cellspacing=1 bgcolor="+titleBg+" id=mainTab〉"+
" 〈tr height=18 style=cursor:default;; οnmοusedοwn='x=event.x;;y=event.y;;setCapture();;mainTab.bgColor=/""+moveBg+" /";;' οnmοuseup='releaseCapture();;mainTab.bgColor=/""+titleBg+"/";;' οnmοusemοve='if(event.button==1)self.moveTo(screenLeft+event.x- x,screenTop+event.y-y);;'〉"+
" 〈td width=18 align=center〉〈img height=12 width=12 border=0 src="+icon+"〉〈/td〉"+
" 〈td width="+w+"〉〈span style=font-size:12px;;color:"+titleColor+";;font-family:宋 体;;position:relative;;top:1px;;〉"+titleWord+"〈/span〉〈/td〉"+
" 〈td width=14〉〈img border=0 width=12 height=12 alt=最小化 src="+minimizebar+" οnmοusedοwn=hhctrl.Click();; οnmοuseοver=this.src='"+minimizebar2+"' οnmοuseοut=this.src='"+minimizebar+"'〉〈/td〉"+
" 〈td width=13〉〈img border=0 width=12 height=12 alt=关闭 src="+closebar+" οnmοusedοwn=self.close();; οnmοuseοver=this.src='"+closebar2+"' οnmοuseοut=this.src='"+closebar+"'〉〈/td〉"+
" 〈/tr〉"+
" 〈tr height=*〉"+
" 〈td colspan=4〉"+
" 〈iframe name=nbw_v6_iframe src="+fileName+" scrolling="+scr+" width=100% height=100% frameborder=0〉〈/iframe〉"+
" 〈/td〉"+
" 〈/tr〉"+
" 〈/table〉"+
"〈/body〉"+
"〈/html〉";;
pop=window.open("","_blank","fullscreen=yes");;
pop.resizeTo(w,h);;
pop.moveTo((screen.width-w)/2,(screen.height-h)/2);;
pop.document.writeln(contents);;
if(pop.document.body.clientWidth!=w||pop.document.body.clientHeight!=h) //如果无边视窗不是出现在纯粹的IE视窗中
{
temp=window.open("","nbw_v6");;
temp.close();;
window.showModalDialog("about: 〈"+"script language=javascript〉 window.open('','nbw_v6','fullscreen=yes');;window.close();;"+" 〈/"+"script〉","","dialogWidth:0px;;dialogHeight:0px");;
pop2=window.open("","nbw_v6");;
pop2.resizeTo(w,h);;
pop2.moveTo((screen.width-w)/2,(screen.height-h)/2);;
pop2.document.writeln(contents);;
pop.close();;
}
}
〈/script〉
//第二步:把如下代码加入〈body〉〈/body〉区域中
〈a href=#none οnclick=noBorderWin('rate.htm','400','240','#000000','#333333','#CCCCCC','一个无边视窗的测试例子','yes');;〉open〈/a〉
让新窗口总在一个窗口弹出
新开一个的窗口(name=screen)
再在这个窗口内打开链接(target=screen)
网页内容顶格
横向不间断滚动广告
Code: [Copy to clipboard]
〈script language="javascript"〉
imgArr=new Array()
imgArr[0]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145003569.gif border=0〉〈/a〉"
imgArr[1]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145004614.gif border=0〉〈/a〉"
imgArr[2]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145005547.gif border=0〉〈/a〉"
imgArr[3]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145008768.gif border=0〉〈/a〉"
imgArr[4]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145009889.gif border=0〉〈/a〉"
imgArr[5]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145009337.gif border=0〉〈/a〉"
imgArr[6]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145009123.gif border=0〉〈/a〉"
imgArr[7]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145010764.gif border=0〉〈/a〉"
imgArr[8]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145010912.gif border=0〉〈/a〉"
imgArr[9]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145010401.gif border=0〉〈/a〉"
imgArr[10]=" 〈a href=# onmouseMove='javascript:outHover=true' onMouseover='javascript:outHover=true' onMouseout='javascript:outHover=false;;mvStart()'〉〈img src=/Article/UploadFiles/200408/20040825145011647.gif border=0〉〈/a〉"
var moveStep=4 //步长,单位:pixel
var moveRelax=100 //移动时间间隔,单位:ms
ns4=(document.layers)?true:false
var displayImgAmount=4 //视区窗口可显示个数
var divWidth=125 //每块图片占位宽
var divHeight=60 //每块图片占位高
var startDnum=0
var nextDnum=startDnum+displayImgAmount
var timeID
var outHover=false
var startDivClipLeft
var nextDivClipRight
function initDivPlace(){
if (ns4){
for (i=0;;i〈displayImgAmount;;i++){
eval("document.divOuter.document.divAds"+i+".left="+divWidth*i)
}
for (i=displayImgAmount;;i〈imgArr.length;;i++){
eval("document.divOuter.document.divAds"+i+".left="+divWidth*displayImgAmount)
}
}else{
for (i=0;;i〈displayImgAmount;;i++){
eval("document.all.divAds"+i+".style.left="+divWidth*i)
}
for (i=displayImgAmount;;i〈imgArr.length;;i++){
eval("document.all.divAds"+i+".style.left="+divWidth*displayImgAmount)
}
}
}
function mvStart(){
timeID=setTimeout(moveLeftDiv,moveRelax)
}
function mvStop(){
clearTimeout(timeID)
}
function moveLeftDiv(){
if (ns4){
for (i=0;;i〈=displayImgAmount;;i++){
eval("document.divOuter.document.divAds"+parseInt((startDnum+i)%imgArr.length)+".left=document.divOuter.document.divAds"+parseInt((startDnum+i)%imgArr.length)+".left-moveStep")
}
startDivClipLeft=parseInt(eval("document.divOuter.document.divAds"+startDnum+".clip.left"))
nextDivClipRight=parseInt(eval("document.divOuter.document.divAds"+nextDnum+".clip.right"))
if (startDivClipLeft+moveStep〉divWidth){
eval("document.divOuter.document.divAds"+nextDnum+".clip.right="+divWidth)
eval("document.divOuter.document.divAds"+startDnum+".left="+divWidth*displayImgAmount)
eval("document.divOuter.document.divAds"+parseInt((nextDnum+1)%imgArr.length)+".left=document.divOuter.document.divAds"+nextDnum+".left+"+divWidth)
eval("document.divOuter.document.divAds"+parseInt((nextDnum+1)%imgArr.length)+".clip.left=0")
startDnum=(++startDnum)%imgArr.length
nextDnum=(startDnum+displayImgAmount)%imgArr.length
startDivClipLeft=moveStep-(divWidth-startDivClipLeft)
nextDivClipRight=moveStep-(divWidth-nextDivClipRight)
}else{
eval("document.divOuter.document.divAds"+nextDnum+".clip.left=0")
startDivClipLeft+=moveStep
nextDivClipRight+=moveStep
}
eval("document.divOuter.document.divAds"+startDnum+".clip.left="+startDivClipLeft)
eval("document.divOuter.document.divAds"+nextDnum+".clip.right="+nextDivClipRight)
}else{
for (i=0;;i〈=displayImgAmount;;i++){
eval("document.all.divAds"+parseInt((startDnum+i)%imgArr.length)+".style.left=document.all.divAds"+parseInt((startDnum+i)%imgArr.length)+".style.pixelLeft-moveStep")
}
startDivClipLeft=parseInt(eval("document.all.divAds"+startDnum+".currentStyle.clipLeft"))
nextDivClipRight=parseInt(eval("document.all.divAds"+nextDnum+".currentStyle.clipRight"))
if (startDivClipLeft+moveStep〉divWidth){
eval("document.all.divAds"+nextDnum+".style.clip='rect(0,"+divWidth+","+divHeight+",0"+")'")
eval("document.all.divAds"+startDnum+".style.left="+divWidth*displayImgAmount)
eval("document.all.divAds"+parseInt((nextDnum+1)%imgArr.length)+".style.left=document.all.divAds"+nextDnum+".style.pixelLeft+"+divWidth)
startDnum=(++startDnum)%imgArr.length
nextDnum=(startDnum+displayImgAmount)%imgArr.length
startDivClipLeft=moveStep-(divWidth-startDivClipLeft)
nextDivClipRight=moveStep-(divWidth-nextDivClipRight)
}else{
startDivClipLeft+=moveStep
nextDivClipRight+=moveStep
}
eval("document.all.divAds"+startDnum+".style.clip='rect(0,"+divWidth+","+divHeight+","+startDivClipLeft+")'")
eval("document.all.divAds"+nextDnum+".style.clip='rect(0,"+nextDivClipRight+","+divHeight+",0)'")
}
if (outHover){
mvStop()
}else{
mvStart()
}
}
function writeDivs(){
if (ns4){
document.write("〈ilayer name=divOuter width=750 height="+divHeight+"〉")
for (i=0;;i〈imgArr.length;;i++){
document.write("〈layer name=divAds"+i+"〉")
document.write(imgArr[i]+" ")
document.write("〈/layer〉")
}
document.write("〈/ilayer〉")
document.close()
for (i=displayImgAmount;;i〈imgArr.length;;i++){
eval("document.divOuter.document.divAds"+i+".clip.right=0")
}
}else{
document.write("〈div id=divOuter style='position:relative' width=750 height="+divHeight+"〉")
for (i=0;;i〈imgArr.length;;i++){
document.write("〈div id=divAds"+i+" style='position:absolute;;clip:rect(0,"+divWidth+","+divHeight+",0)'〉")
document.write(imgArr[i]+" ")
document.write("〈/div〉")
}
document.write("〈/div〉")
for (i=displayImgAmount;;i〈imgArr.length;;i++){
eval("document.all.divAds"+i+".style.clip='rect(0,0,"+divHeight+",0)'")
}
}
}
〈/script〉
〈BODY οnlοad=javascript:mvStart()〉
〈SCRIPT language=javascript〉writeDivs();;initDivPlace();;〈/SCRIPT〉
电击图片弹出无边自定义窗口
Code: [Copy to clipboard]
〈a href="#"〉〈img src="image/tx.gif" alt="更换头像" width="16" height="16" hspace=10 border=0 onClick="MM_openBrWindow('tx.htm','tx','status=yes,scrollbars=yes,width=280,height=45')"〉 〈/a〉
无边框对话框窗口可以在myie中弹出
Code: [Copy to clipboard]
〈script Language="javascript"〉
function 页面名称(WINwidth, WINheight) {
showx = event.screenX - event.offsetX - 4 - WINwidth ;; // + deltaX;;
showy = event.screenY - event.offsetY + 18;; // + deltaY;;
newWINwidth = WINwidth + 4 + 18;;
var features =
'dialogWidth:' + newWINwidth + 'px;;' +
'dialogHeight:' + WINheight + 'px;;' +
'dialogLeft:' + showx + 'px;;' +
'dialogTop:' + showy + 'px;;' +
'directories:no;; localtion:no;; menubar:no;; status=no;; toolbar=no;;scrollbars:no;;Resizeable=no';;
var endtarget = "弹出页面.htm";;
// window.open(endtarget, '', '');;
window.showModalDialog(endtarget, " ", features);;
}
〈/script〉
Code: [Copy to clipboard]
〈input name="image" type=image onClick="页面名称(230, 35);;return false;;" src="代替按扭的图片.gif" alt="鼠标经过显示的文字" width="16" height="16" 〉
Java代码容错
Code: [Copy to clipboard]
〈SCRIPT LANGUAGE="javascript"〉
〈!-- Hide
function killErrors() {
return true;;
}
window.onerror = killErrors;;
// --〉
〈/SCRIPT〉
flash透明
Code: [Copy to clipboard]
〈PARAM NAME="wmode" VALUE="transparent"〉
状态栏 +在body中就ok
〈script language="javascript"〉
var MESSAGE = " 欢迎来到落伍者论坛谢谢! "
var POSITION = 150
var DELAY = 10
var scroll = new statusMessageObject()
function statusMessageObject(p,d) {
this.msg = MESSAGE
this.out = " "
this.pos = POSITION
this.delay = DELAY
this.i = 0
this.reset = clearMessage}
function clearMessage() {
this.pos = POSITION}
function scroller() {
for (scroll.i = 0;; scroll.i 〈 scroll.pos;; scroll.i++) {
scroll.out += " "}
if (scroll.pos 〉= 0)
scroll.out += scroll.msg
else scroll.out = scroll.msg.substring(-scroll.pos,scroll.msg.length)
window.status = scroll.out
scroll.out = " "
scroll.pos--
if (scroll.pos 〈 -(scroll.msg.length)) {
scroll.reset()}
setTimeout ('scroller()',scroll.delay)}
function snapIn(jumpSpaces,position) {
var msg = scroll.msg
var out = ""
for (var i=0;; i〈position;; i++)
{out += msg.charAt(i)}
for (i=1;;i〈jumpSpaces;;i++)
{out += " "}
out += msg.charAt(position)
window.status = out
if (jumpSpaces 〈= 1) {
position++
if (msg.charAt(position) == ' ')
{position++ }
jumpSpaces = 100-position
} else if (jumpSpaces 〉 3)
{jumpSpaces *= .75}
else
{jumpSpaces--}
if (position != msg.length) {
var cmd = "snapIn(" + jumpSpaces + "," + position + ")";;
scrollID = window.setTimeout(cmd,scroll.delay);;
} else { window.status=""
jumpSpaces=0
position=0
cmd = "snapIn(" + jumpSpaces + "," + position + ")";;
scrollID = window.setTimeout(cmd,scroll.delay);;
return false }
return true}
snapIn(100,0);;
〈/script〉
1.页面自动刷新:把如下代码加入〈head〉区域中
Code: [Copy to clipboard]
〈meta http-equiv="refresh" content="20"〉
其中20指每隔20秒刷新一次页面。
2.页面自动跳转:把如下代码加入〈head〉区域中
Code: [Copy to clipboard]
〈meta http-equiv="refresh" content="20;;url=http://kingsnet.126.com"〉
asp 随机图片显示 百变美女asp代码
Code: [Copy to clipboard]
〈%@LANGUAGE="VBSCRIPT " CODEPAGE="936"%〉
〈%
'----------------------------------------------------------------------------------------
'转发时请保留此声明信息,这段声明不并会影响你的显示速度!
'************************* 随机图片显示 ****************************
'代码设计:野汉子
'使用实例:img.asp?list=图片存放目录
'网站:http://yjj.con.cn
'声明:版权没有,随意使用!^_^不过如果各位不介意给我做个小小的连接,在下将感激不尽!
'----------------------------------------------------------------------------------------
Function AllPath()
Dim Domain,GFilePath
Domain = Request.ServerVariables("SERVER_NAME")
GFilePath = Request.ServerVariables("PATH_INFO")
GFilePath = lcase(left(GFilePath,instrRev(GFilePath,"/")))
AllPath = "http://"&Domain&GFilePath
End Function
Function ShowFileList(folderspec)
Dim Path,objFSO,objFolder,count,objFile,nume,S
Path = Server.MapPath(folderspec)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(Path) Then
Set objFolder = objFSO.GetFolder(Path)
count = 0
For Each objFile in objFolder.Files
count = count+1
Next
randomize
nume = Int((count*rnd)+1)
S = 0
ShowFileList = ""
For Each objFile in objFolder.Files
S = S + 1
If S = nume Then
ShowFileList = objFile.Name
Exit For
End If
Next
Set objFolder = Nothing
Else
ShowFileList = "NO"
End If
Set objFSO = Nothing
End Function
Dim list,filename,address,str
list = trim(Request.QueryString("list"))
if list = "" then
Response.write "本页需要正确参数引入,您缺少相关的参数!正确格式如下:"&AllPath&"img.asp?list=图片存放目录"
Response.End()
end if
filename = ShowFileList("./"&list&"/")
if filename = "NO" then
Response.write "您指定的目录〈b〉"&list&"〈/b〉不存在,请重新指定!"
Response.End()
end if
if filename = "" then
Response.write "您指定的目录〈b〉"&list&"〈/b〉没有相关的图片文件存在,请重新指定!"
Response.End()
end if
str = right(filename,3)
if str〈〉"jpg" and str〈〉"gif" then
filename = "erro.gif"
end if
address = AllPath&list&"/"
address = address&filename
%〉
〈%Response.redirect(address)%〉
鼠标经过显示不同图片
Code: [Copy to clipboard]
〈SCRIPT LANGUAGE="javascript"〉
var a = new Image();;
var b = new Image();;
var c = new Image();;
a.src = "../../../yanyanyan/me/me/4.jpg";;
b.src = "../../../yanyanyan/me/me/3.jpg";;
c.src = "../../../yanyanyan/me/me/2.jpg";;
function doButtons(picimage) {
eval("document['picture'].src = " + picimage + ".src");;
}
〈/script〉
〈/head〉
〈body〉
〈table width="407" height="201" border=0 cellpadding="0" cellspacing="0" bgcolor="#333333"〉
〈tr〉〈td width="110" align="center"〉
〈p〉
〈a href="#" οnmοuseοver="doButtons('a')"〉PHOTO 1〈/a〉〈p〉
〈a href="#" οnmοuseοver="doButtons('b')"〉PHOTO 2〈/a〉〈p〉
〈a href="#" οnmοuseοver="doButtons('c')"〉PHOTO 3〈/a〉〈p〉
〈td width="297"〉〈img name=picture src="../../../yanyanyan/me/me/4.jpg" width=294 height=345 border=0〉〈/td〉
〈/tr〉
〈/table〉
Code: [Copy to clipboard]
〈style〉
.jc{
position:relative;;
}
〈/style〉
〈script language="javascript1.2"〉
var ns6=document.getElementById&&!document.all
var ie=document.all
var customcollect=new Array()
var i=0
function jiggleit(num){
if ((!document.all&&!document.getElementById)) return;;
customcollect[num].style.left=(parseInt(customcollect[num].style.left)==-1)? customcollect[num].style.left=1 : customcollect[num].style.left=-1
}
function init(){
if (ie){
while (eval("document.all.jiggle"+i)!=null){
customcollect[i]= eval("document.all.jiggle"+i)
i++
}
}
else if (ns6){
while (document.getElementById("jiggle"+i)!=null){
customcollect[i]= document.getElementById("jiggle"+i)
i++
}
}
if (customcollect.length==1)
setInterval("jiggleit(0)",80)
else if (customcollect.length〉1)
for (y=0;;y〈customcollect.length;;y++){
var tempvariable='setInterval("jiggleit('+y+')",'+'100)'
eval(tempvariable)
}
}
window.οnlοad=init
〈/script〉
〈span id="jiggle0" class="jc"〉〈b〉抖动的字〈a href="http://yjj.con.cn "〉Website 俊杰网络!〈/a〉〈/b〉〈/span〉
〈/head〉
标题拦特效
Code: [Copy to clipboard]
〈SCRIPT〉
//change title text to your own
var titletext="Welcome to Dynamic Drive"
var thetext=""
var started=false
var step=0
var times=1
function welcometext()
{
times--
if (times==0)
{
if (started==false)
{
started = true;;
document.title = titletext;;
setTimeout("anim()",1);;
}
thetext = titletext;;
}
}
function showstatustext(txt)
{
thetext = txt;;
setTimeout("welcometext()",4000)
times++
}
function anim()
{
step++
if (step==7) {step=1}
if (step==1) {document.title='〉==='+thetext+'===〈'}
if (step==2) {document.title='=〉=='+thetext+'==〈='}
if (step==3) {document.title='〉=〉='+thetext+'=〈=〈'}
if (step==4) {document.title='=〉=〉'+thetext+'〈=〈='}
if (step==5) {document.title='==〉='+thetext+'=〈=='}
if (step==6) {document.title='===〉'+thetext+'〈==='}
setTimeout("anim()",200);;
}
if (document.title)
window.οnlοad=οnlοad=welcometext
〈/SCRIPT〉
文字不同颜色闪烁
〈span style=behavior:url(font.htc)〉这里是要闪烁的字颜色可以很多〈/span〉
font.htc 代码
Code: [Copy to clipboard]
*************************************************
〈PUBLIC:COMPONENT URN="rainbow" name="darainbow()"/〉
〈PUBLIC:ATTACH EVENT = "oncontentready" ONEVENT ="beginIt()"/〉
〈SCRIPT language="javascript"〉
var Kill_ID=null;;
var internalValue;;
var originalValue;;
function putValue(){
element.innerHTML=internalValue;;
encapsulate();;
startSwirl();;
}
function eventHandler(){
clearInterval(Kill_ID);;
internalValue=element.value;;
element.detachEvent("onpropertychange",eventHandler);;
if(event.propertyName=="value"){
element.innerHTML=internalValue;;
putValue();;
} else startSwirl();;
element.attachEvent("onpropertychange",eventHandler);;
}
function swirl(){
var I;;
I=ran(internalValue.length-1,0);;
if(element.children(I) != null)element.children(I).style.color=randomColor();;
}
function startSwirl(){
if (element.swirlInterval == null)
element.swirlInterval=50;;
if ((internalValue!=null) && (element.swirlInterval!=0))
Kill_ID=setInterval(swirl,element.swirlInterval);;
}
function encapsulate(){
var I;;
var tempStr="";;
for (I=0;; I 〈 internalValue.length;; I++){
tempStr += "〈SPAN style=/"color:"+randomColor()+"/"〉" + internalValue.substr(I,1) + "〈/SPAN〉";;
}
innerHTML=tempStr;;
}
function ran(upperbound, lowerbound){
return(parseInt((upperbound - lowerbound + 1) * Math.random() + lowerbound));;
}
function randomColor(){
var R=ran(255,0);;
var G=ran(255,0);;
var B=ran(255,0);;
R=R.toString(16);;
G=G.toString(16);;
B=B.toString(16);;
if (R.length==1)R="0"+R;;
if (G.length==1)G="0"+G;;
if (B.length==1)B="0"+B;;
return("#"+R+G+B);;
}
function beginIt(){
internalValue=element.value;;
originalValue=element.innerHTML;;
if (internalValue==null)
internalValue=element.innerHTML;;
putValue();;
element.attachEvent("onpropertychange",eventHandler);;
}
function clearIt(){
clearInterval(Kill_ID);;
element.detachEvent("onpropertychange",eventHandler);;
element.innerHTML=originalValue;;
}
〈/script〉
***************************************
让连接不停的变色
〈SCRIPT language=javascript src="fade.js"〉〈/SCRIPT〉
演示 http://www.wooshow.com/dw/demo/ln/1.htm
fade.js代码
Code: [Copy to clipboard]
/*************
**** 〈config〉
**/
startColor = "#4D4D4D";; // 颜色可以该
endColor = "#ffffff";; // MouseOver link color
stepIn = 10;; // delay when fading in
stepOut = 20;; // delay when fading out
/*
** set to true or false;; true will
** cause all links to fade automatically
***/
autoFade = true;;
/*
** set to true or false;; true will cause all CSS
** classes with "fade" in them to fade onmouseover
***/
sloppyClass = true;;
/**
**** 〈/config〉
**************/
/*************
**** 〈install〉
**
**
**** 〈/install〉
**************/
hexa = new makearray(16);;
for(var i = 0;; i 〈 10;; i++)
hexa[i] = i;;
hexa[10]="a";; hexa[11]="b";; hexa[12]="c";;
hexa[13]="d";; hexa[14]="e";; hexa[15]="f";;
document.onmouseover = domouseover;;
document.onmouseout = domouseout;;
startColor = dehexize(startColor.toLowerCase());;
endColor = dehexize(endColor.toLowerCase());;
var fadeId = new Array();;
var timerID = 0;;
var theElement,theTagName,theClassName,theUniqueID
function dehexize(Color){
var colorArr = new makearray(3);;
for (i=1;; i〈7;; i++){
for (j=0;; j〈16;; j++){
if (Color.charAt(i) == hexa[j]){
if (i%2 !=0)
colorArr[Math.floor((i-1)/2)]=eval(j)*16;;
else
colorArr[Math.floor((i-1)/2)]+=eval(j);;
}
}
}
return colorArr;;
}
function domouseover() {
if(document.all) {
clearTimeout(timerID);;
theElement = event.srcElement;;
theTagName = theElement.tagName;;
theClassName = theElement.className;;
theUniqueID = theElement.uniqueID;;
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) {
//alert(theElement);;
fade(startColor,endColor,theUniqueID,stepIn);;
timerID = setTimeout('pulsedown()',500);;
}
}
}
function pulseup() {
if(document.all) {
clearTimeout(timerID);;
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) {
//alert(theElement);;
fade(startColor,endColor,theUniqueID,stepIn);;
timerID = setTimeout('pulsedown(theElement)',500);;
}
}
}
function pulsedown(theElement) {
if (document.all) {
clearTimeout(timerID);;
if ((theTagName == "A" && autoFade) || theClassName == "fade" || (sloppyClass && theClassName.indexOf("fade") != -1)) {
//alert(theElement);;
fade(endColor,startColor,theUniqueID,stepOut);;
timerID = setTimeout('pulseup()',500);;
}
}
}
function domouseout() {
if (document.all) {
clearTimeout(timerID);;
var srcElement = event.srcElement;;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(endColor,startColor,srcElement.uniqueID,stepOut);;
}
}
function makearray(n) {
this.length = n;;
for(var i = 1;; i 〈= n;; i++)
this[i] = 0;;
return this;;
}
function hex(i) {
if (i 〈 0)
return "00";;
else if (i 〉 255)
return "ff";;
else
return "" + hexa[Math.floor(i/16)] + hexa[i%16];;}
function setColor(r, g, b, element) {
var hr = hex(r);; var hg = hex(g);; var hb = hex(b);;
element.style.color = "#"+hr+hg+hb;;
}
function fade(s,e, element,step){
var sr = s[0];; var sg = s[1];; var sb = s[2];;
var er = e[0];; var eg = e[1];; var eb = e[2];;
if (fadeId[0] != null && fade[0] != element){
setColor(sr,sg,sb,eval(fadeId[0]));;
var i = 1;;
while(i 〈 fadeId.length){
clearTimeout(fadeId[i]);;
i++;;
}
}
for(var i = 0;; i 〈= step;; i++) {
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");;",i*step);;
}
fadeId[0] = element;;
}
要使背景图案不随文字;滚动”的CSS是这样的:
Code: [Copy to clipboard]
〈style type="text/css"〉
〈!--
BODY { background: purple url(bg.jpg);;
background-repeat:repeat-y;;
background-attachment:fixed
}
--〉
〈/style〉
页面过滤渐变加到〈head〉中
Code: [Copy to clipboard]
〈meta http-equiv="Page-Exit" content="revealTrans(Duration=1,Transition=23)"〉
鼠标移动到版块图标产生的渐变效果
1.inc/main.js末尾增加如下代码:
//渐隐渐现函数
nereidFadeObjects = new Object();;
nereidFadeTimers = new Object();;
function nereidFade(object, destOp, rate, delta) {
if (!document.all) {return;;}
if (object != "[object]"){
setTimeout("nereidFade("+object+","+destOp+","+rate+","+delta+")",0);;
return;;
}
clearTimeout(nereidFadeTimers[object.sourceIndex]);;
diff = destOp-object.filters.alpha.opacity;;
direction = 1;;
if (object.filters.alpha.opacity 〉 destOp){
direction = -1;;
}
delta=Math.min(direction*diff,delta);;
object.filters.alpha.opacity+=direction*delta;;
if (object.filters.alpha.opacity != destOp){
nereidFadeObjects[object.sourceIndex]=object;;
nereidFadeTimers[object.sourceIndex]=setTimeout("nereidFade(nereidFadeObjects["+object.sourceIndex+"],"+destOp+","+rate+","+delta+")",rate);;
}
}
2.index模板html(7):
function showboard
.......
if (indexIMG!='')
{
str = str.replace(/{/$indexIMG}/gi,'〈table align="left"〉〈tr〉〈td〉〈a href="list.asp?boardid='+BoardID+'"〉 〈img src='+indexIMG+' align="top" border="0" style="FILTER: alpha(opacity=40)" onMouseOut=nereidFade(this,40,10,10) onMouseOver=nereidFade(this,100,0,10) 〉〈/a〉〈/td〉〈td width="20"〉〈/td〉〈/tr〉〈/table〉');;
}
else
{
str = str.replace(/{/$indexIMG}/gi,'');;
}
......
增加以上红色部分。
任何连接滑过就点击
Code: [Copy to clipboard]
〈script〉
function mClk2() {var source=event.srcElement;;if (source.tagName=="A"){source.click();;self.focus();;}}
document.write("〈div οnmοuseοver=mClk2();;〉");;
〈/script〉
不错的向上滚动广告代码
演示 http://gong.88qq.com/88qq_468-60-lun.htm
Code: [Copy to clipboard]
〈SCRIPT language=javascript1.2〉
〈!--
var scrollerwidth=470
var scrollerheight=60
var scrollerbgcolor='#cccccc'
var pausebetweenimages=10000
var waitingtime=20
var slideimages=new Array()
slideimages[0]='〈iframe src="http://gong.88qq.com/88qq_468-60-5.htm " width="468" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"〉〈/iframe〉'
slideimages[1]='〈iframe src="http://gong.88qq.com/88qq_468-60-2.htm " width="468" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"〉〈/iframe〉'
slideimages[2]='〈iframe src="http://gong.88qq.com/88qq_468-60-1.htm " width="468" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"〉〈/iframe〉'
slideimages[3]='〈iframe src="http://gong.88qq.com/88qq_468-60-4.htm " width="468" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"〉〈/iframe〉'
slideimages[4]='〈iframe src="http://gong.88qq.com/88qq_468-60-3.htm " width="468" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"〉〈/iframe〉'
slideimages[5]='〈iframe src="http://gong.88qq.com/88qq_468-60-6.htm " width="468" height="60" frameborder="no" border="0" marginwidth="0" marginheight="0" scrolling="no"〉〈/iframe〉'
if (slideimages.length〉1)
i=2
else
i=0
function move1(whichlayer){
tlayer=eval(whichlayer)
if (tlayer.top〉0&&tlayer.top〈=5){
tlayer.top=0
setTimeout("move1(tlayer)",pausebetweenimages)
setTimeout("move2(document.main.document.second)",pausebetweenimages)
return
}
if (tlayer.top〉=tlayer.document.height*-1){
tlayer.top-=5
setTimeout("move1(tlayer)",waitingtime)
}
else{
tlayer.top=scrollerheight
tlayer.document.write(slideimages[i])
tlayer.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}}
function move2(whichlayer){
tlayer2=eval(whichlayer)
if (tlayer2.top〉0&&tlayer2.top〈=5){
tlayer2.top=0
setTimeout("move2(tlayer2)",pausebetweenimages)
setTimeout("move1(document.main.document.first)",pausebetweenimages)
return
}
if (tlayer2.top〉=tlayer2.document.height*-1){
tlayer2.top-=5
setTimeout("move2(tlayer2)",waitingtime)
}
else{
tlayer2.top=scrollerheight
tlayer2.document.write(slideimages[i])
tlayer2.document.close()
if (i==slideimages.length-1)
i=0
else
i++
}}
function move3(whichdiv){
tdiv=eval(whichdiv)
if (tdiv.style.pixelTop〉0&&tdiv.style.pixelTop〈=5){
tdiv.style.pixelTop=0
setTimeout("move3(tdiv)",pausebetweenimages)
setTimeout("move4(second2)",pausebetweenimages)
return
}
if (tdiv.style.pixelTop〉=tdiv.offsetHeight*-1){
tdiv.style.pixelTop-=5
setTimeout("move3(tdiv)",waitingtime)
}
else{
tdiv.style.pixelTop=scrollerheight
tdiv.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}
}
function move4(whichdiv){
tdiv2=eval(whichdiv)
if (tdiv2.style.pixelTop〉0&&tdiv2.style.pixelTop〈=5){
tdiv2.style.pixelTop=0
setTimeout("move4(tdiv2)",pausebetweenimages)
setTimeout("move3(first2)",pausebetweenimages)
return
}
if (tdiv2.style.pixelTop〉=tdiv2.offsetHeight*-1){
tdiv2.style.pixelTop-=5
setTimeout("move4(second2)",waitingtime)
}
else{
tdiv2.style.pixelTop=scrollerheight
tdiv2.innerHTML=slideimages[i]
if (i==slideimages.length-1)
i=0
else
i++
}}
function startscroll(){
if (document.all){
move3(first2)
second2.style.top=scrollerheight
}
else if (document.layers){
move1(document.main.document.first)
document.main.document.second.top=scrollerheight+5
document.main.document.second.visibility='show'
}}
window.οnlοad=startscroll
//--〉
〈/SCRIPT〉
〈ILAYER id=main bgcolor="&;{scrollerbgcolor};;"
height="&;{scrollerheight};;" width="&;{scrollerwidth};;"〉〈LAYER id=first
width="&;{scrollerwidth};;" top="1" left="0"〉
〈SCRIPT language=javascript1.2〉
if (document.layers)
document.write(slideimages[0])
〈/SCRIPT〉
〈/LAYER〉〈LAYER id=second width="&;{scrollerwidth};;" top="0" left="0"
visibility="hide"〉
〈SCRIPT language=javascript1.2〉
if (document.layers)
document.write(slideimages[1])
〈/SCRIPT〉
〈/LAYER〉〈/ILAYER〉
〈SCRIPT language=javascript1.2〉
〈!--
if (document.all){
document.writeln(' 〈span id="main2" style="position:relative;;width:'+scrollerwidth+';;height:'+scrollerheight+';;overflow:hiden;;background- color:'+scrollerbgcolor+'"〉')
document.writeln('〈div style="position:absolute;;width:'+scrollerwidth+';;height:'+scrollerheight+';;clip:rect(0 '+scrollerwidth+' '+scrollerheight+' 0);;left:0;;top:0"〉')
document.writeln('〈div id="first2" style="position:absolute;;width:'+scrollerwidth+';;left:0;;top:1;;"〉')
document.write(slideimages[0])
document.writeln('〈/div〉')
document.writeln('〈div id="second2" style="position:absolute;;width:'+scrollerwidth+';;left:0;;top:0"〉')
document.write(slideimages[1])
document.writeln('〈/div〉')
document.writeln('〈/div〉')
document.writeln('〈/span〉')
}
//--〉
〈/SCRIPT〉
点广告才可以下载的代码
这样写 点了广告就在新页面自动下载了
Code: [Copy to clipboard]
〈table οnclick="window.open('下载地址','_blank','width=0,height=0')"〉〈tr〉〈td〉〈广告代码〉〈/td〉〈/tr〉〈/table〉
站长站弹出广告代码
Code: [Copy to clipboard]
〈SCRIPT language=javascript〉window.showModelessDialog("http://www.chinaz.com/A-Ddi.htm","CHINAZDindexP","center:no ;;dialogLeft:5px;;dialogTop:5px;;scroll:0;;status:0;;help:0;;resizable:0;;dialogWidth:305px;;dialogHeight:325px")〈/SCRIPT〉
总在最下的广告代码
Code: [Copy to clipboard]
〈!--用〈body onLoad='fix()' onScroll="fix()" onResize="fix()"〉替换〈body〉 --〉
〈!--将以下代码加入HTML的〈Body〉〈/Body〉之间--〉
〈script language="javascript"〉
〈!--
function stat(){
var a = pageYOffset+window.innerHeight-document.bar.document.height-15
document.bar.top = a
setTimeout('stat()',2)
}
function fix(){
nome=navigator.appName
if(nome=='Netscape'){
stat()
}
else{
var a=document.body.scrollTop+document.body.clientHeight-document.all.bar.offsetHeight+15
bar.style.top = a
}}
//--〉
〈/script〉
〈span id="bar" style="position:absolute;; left:68px;; top:455px;; width:614px;; height:45px;; z-index:9" 〉
〈table align="center" border="1" hspace="1" cellpadding="1" bordercolor="#000000" bgcolor="#FFFFFF"〉
〈tr align="center"〉
〈td 〉 〈a href="http://remotion.myetang.com "〉网页特效梦工厂〈/a〉〈/td〉
〈td 〉 〈a href="http://www.skycn.com "〉天空下载〈/a〉〈/td〉
〈/tr〉〈/table〉〈/span〉
定时更换超级连接的代码
Code: [Copy to clipboard]
〈!--用〈body οnlοad="if (document.all||document.layers) {regenerate2();;update()}"〉替换原来的〈Body〉--〉
〈!--将以下代码加入HTML的〈Body〉〈/Body〉之间--〉
〈style〉
〈!--
#tickertape{
position:relative;;
layer-background-color:black;;
width:400;;
height:12;;
;; font-family: "宋体";; font-size: 9pt}
#subtickertape{
background-color:black;;
position:absolute;;
border: 1px solid black;;
width:400;;
height:12;;
;; font-family: "宋体";; font-size: 9pt
}
.subtickertapefont{
font:bold 9pt "宋体";;
text-decoration:none;;
color:white;;
}
.subtickertapefont a{
color:white;;
text-decoration:none;;
;; font-family: "宋体";; font-size: 9pt}
--〉
〈/style〉
〈div id="tickertape"〉
〈div id="subtickertape" class="subtickertapefont"〉初始化...〈/div〉
〈/div〉
〈script language="javascript1.2"〉
var speed=4500
var news=new Array()
news[0]="〈a href='http://remotion.myetang.com'〉网页特效梦工厂〈/a〉"
news[1]="〈a href='http://www.skycn.com'〉天空下载〈/a〉"
news[2]="〈a href='http://www.delphibbs.com'〉大富翁论坛〈/a〉"
i=0
if (document.all)
tickerobject=document.all.subtickertape.style
else
tickerobject=document.tickertape.document
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers)
setTimeout("window.οnresize=regenerate",450)
}
function update(){
BgFade(0xff,0xff,0xff, 0x00,0x00,0x00,10);;
if (document.layers){
document.tickertape.document.subtickertape.document.write('〈span class="subtickertapefont"〉'+news[i]+'〈/span〉')
document.tickertape.document.subtickertape.document.close()
}
else
document.all.subtickertape.innerHTML=news[i]
if (i〈news.length-1)
i++
else
i=0
setTimeout("update()",speed)
}
function BgFade(red1, grn1, blu1, red2,
grn2, blu2, steps) {
sred = red1;; sgrn = grn1;; sblu = blu1;;
ered = red2;; egrn = grn2;; eblu = blu2;;
inc = steps;;
step = 0;;
RunFader();;
}
function RunFader() {
var epct = step/inc;;
var spct = 1 - epct;;
if (document.layers)
tickerobject.bgColor =
Math.floor(sred * spct + ered *
epct)*256*256 +
Math.floor(sgrn * spct + egrn * epct)*256 +
Math.floor(sblu * spct + eblu * epct);;
else
tickerobject.backgroundColor=
Math.floor(sred * spct + ered *
epct)*256*256 +
Math.floor(sgrn * spct + egrn * epct)*256 +
Math.floor(sblu * spct + eblu * epct);;
if ( step 〈 inc ) {
setTimeout('RunFader()',50);;
}
step++;;
}
〈/script〉
〈/tr〉〈/table〉
星空背景
Code: [Copy to clipboard]
〈!-- 用〈BODY bgColor=#000000 οnlοad=fly()〉替换原有的〈body〉 --〉
〈!--将以下代码加入HTML的〈Body〉〈/Body〉之间--〉
〈SCRIPT language=javascript〉
〈!--
SmallStars = 30;;
LargeStars = 10;;
SmallYpos = new Array();;
SmallXpos = new Array();;
LargeYpos = new Array();;
LargeXpos = new Array();;
Smallspeed= new Array();;
Largespeed= new Array();;
ns=(document.layers)?1:0;;
if (ns){
for (i = 0;; i 〈 SmallStars;; i++)
{document.write("〈LAYER NAME='sn"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFF0' CLIP='0,0,1,1'〉〈/LAYER〉")}
for (i = 0;; i 〈 LargeStars;; i++)
{document.write("〈LAYER NAME='ln"+i+"' LEFT=0 TOP=0 BGCOLOR='#FFFFFF' CLIP='0,0,2,2'〉〈/LAYER〉")}
}
else{
document.write('〈div style="position:absolute;;top:0px;;left:0px"〉');;
document.write('〈div style="position:relative"〉');;
for (i = 0;; i 〈 SmallStars;; i++)
{document.write(' 〈div id="si" style="position:absolute;;top:0;;left:0;;width:1px;;height:1px;;background:#fffff0;;font- size:1px"〉〈/div〉')}
document.write('〈/div〉');;
document.write('〈/div〉');;
document.write('〈div style="position:absolute;;top:0px;;left:0px"〉');;
document.write('〈div style="position:relative"〉');;
for (i = 0;; i 〈 LargeStars;; i++)
{document.write(' 〈div id="li" style="position:absolute;;top:0;;left:0;;width:2px;;height:2px;;background:#ffffff;;font- size:2px"〉〈/div〉')}
document.write('〈/div〉');;
document.write('〈/div〉');;
}
WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;;
WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;;
//Inital placement!
for (i=0;; i 〈 SmallStars;; i++)
{
SmallYpos[i] = Math.round(Math.random()*WinHeight);;
SmallXpos[i] = Math.round(Math.random()*WinWidth);;
Smallspeed[i]= Math.random()*5+1;;
}
for (i=0;; i 〈 LargeStars;; i++)
{
LargeYpos[i] = Math.round(Math.random()*WinHeight);;
LargeXpos[i] = Math.round(Math.random()*WinWidth);;
Largespeed[i]= Math.random()*10+5;;
}
function fly(){
var WinHeight=(document.layers)?window.innerHeight:window.document.body.clientHeight;;
var WinWidth=(document.layers)?window.innerWidth:window.document.body.clientWidth;;
var hscrll=(document.layers)?window.pageYOffset:document.body.scrollTop;;
var wscrll=(document.layers)?window.pageXOffset:document.body.scrollLeft;;
for (i=0;; i 〈 LargeStars;; i++)
{
LargeXpos[i]-=Largespeed[i];;
if (LargeXpos[i] 〈 -10)
{
LargeXpos[i]=WinWidth;;
LargeYpos[i]=Math.round(Math.random()*WinHeight);;
Largespeed[i]=Math.random()*10+5;;
}
if (ns){
document.layers['ln'+i].left=LargeXpos[i];;
document.layers['ln'+i].top=LargeYpos[i]+hscrll;;
}
else{
li[i].style.pixelLeft=LargeXpos[i];;
li[i].style.pixelTop=LargeYpos[i]+hscrll;;
}
}
for (i=0;; i 〈 SmallStars;; i++)
{
SmallXpos[i]-=Smallspeed[i];;
if (SmallXpos[i] 〈 -10)
{
SmallXpos[i]=WinWidth;;
SmallYpos[i]=Math.round(Math.random()*WinHeight);;
Smallspeed[i]=Math.random()*5+1;;
}
if (ns){
document.layers['sn'+i].left=SmallXpos[i];;
document.layers['sn'+i].top=SmallYpos[i]+hscrll;;
}
else{
si[i].style.pixelLeft=SmallXpos[i];;
si[i].style.pixelTop=SmallYpos[i]+hscrll;;
}
}
setTimeout('fly()',10);;
}
//fly();;
//--〉
〈/SCRIPT〉
时间特效。js读取时间
Code: [Copy to clipboard]
〈!--将以下代码加入HTML的〈Body〉〈/Body〉之间--〉
〈script language="javascript"〉
〈!---
today=new Date();;
var hours = today.getHours();;
var minutes = today.getMinutes();;
var seconds = today.getSeconds();;
var timeValue = "〈FONT COLOR=black〉" + ((hours 〉12) ? hours -12 :hours);; timeValue += ((minutes 〈 10) ? "〈BLINK〉〈FONT COLOR=black〉:〈/FONT〉〈/BLINK〉0" : "〈BLINK〉〈FONT COLOR=black〉:〈/FONT〉〈/BLINK〉") + minutes+"〈/FONT〉〈/FONT〉";;
timeValue += (hours 〉= 12) ? "〈FONT COLOR=blue〉〈I〉〈B〉pm〈/B〉〈/I〉〈/FONT〉" : "〈FONT COLOR=blue〉〈B〉〈I〉am〈/I〉〈/B〉〈/FONT〉";;
function initArray(){
this.length=initArray.arguments.length
for(var i=0;;i〈this.length;;i++)
this[i+1]=initArray.arguments[i] }
var d=new initArray("〈font color=RED〉星期日","〈font color=black〉星期一","〈font color=black〉星期二","〈font color=black〉星期三","〈font color=black〉星期四","〈font color=black〉星期五","〈font color=red〉星期六");; document.write("〈font color=black〉",today.getYear(),"〈font color=black〉年","〈font color=black〉",today.getMonth()+1,"〈font color=black〉月","〈font color=black〉",today.getDate(),"〈font color=black〉日 〈/FONT〉",d[today.getDay()+1]," ",timeValue);; //--〉
〈/script〉
鼠标经过图片加亮显示
Code: [Copy to clipboard]
〈!--将以下代码加入HTML的〈Body〉〈/Body〉之间--〉
〈SCRIPT language="javascript"〉
〈!--
function makevisible(cur,which){
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=20
}
//--〉
〈/SCRIPT〉
〈img src="image/flag.gif"
style="filter:alpha(opacity=20)"
onMouseOver="makevisible(this,0)"
onMouseOut="makevisible(this,1)"〉
鼠标经过图片晃动效果
Code: [Copy to clipboard]
〈!--将以下代码加入HTML的〈Body〉〈/Body〉之间--〉
〈style〉
.shakeimage{
position:relative
}
〈/style〉
〈img src=image/family.jpg class="shakeimage" onMouseover="init(this);;rattleimage()" onMouseout="stoprattle(this)"〉
〈script language="javascript1.2"〉
var rector=3
var stopit=0
var a=1
function init(which){
stopit=0
shake=which
shake.style.left=0
shake.style.top=0
}
function rattleimage(){
if ((!document.all&&!document.getElementById)||stopit==1)
return
if (a==1){
shake.style.top=parseInt(shake.style.top)+rector
}
else if (a==2){
shake.style.left=parseInt(shake.style.left)+rector
}
else if (a==3){
shake.style.top=parseInt(shake.style.top)-rector
}
else{
shake.style.left=parseInt(shake.style.left)-rector
}
if (a〈4)
a++
else
a=1
setTimeout("rattleimage()",50)
}
function stoprattle(which){
stopit=1
which.style.left=0
which.style.top=0
}
〈/script〉
图片幻灯片显示效果
Code: [Copy to clipboard]
〈html〉
〈head〉
〈meta http-equiv="Content-Type" content="text/html;; charset=gb2312"〉
〈title〉图片幻灯片显示效果〈/title〉
〈SCRIPT LANGUAGE="javascript"〉
// Set slideShowSpeed (milliseconds)
var slideShowSpeed = 5000;;
// Duration of crossfade (seconds)
var crossFadeDuration = 3;;
// Specify the image files
var Pic = new Array();;
// to add more images, just continue
// the pattern, adding to the array below
Pic[0] = 'images/1.jpg'
Pic[1] = 'images/2.jpg'
Pic[2] = 'images/3.jpg'
Pic[3] = 'images/4.jpg'
Pic[4] = 'images/5.jpg'
Pic[5] = 'images/6.jpg'
Pic[6] = 'images/7.jpg'
Pic[7] = 'images/8.jpg'
Pic[8] = 'images/9.jpg'
Pic[9] = 'images/10.jpg'
Pic[10] = 'images/11.jpg'
Pic[11] = 'images/12.jpg'
Pic[12] = 'images/13.jpg'
Pic[13] = 'images/14.jpg'
Pic[14] = 'images/15.jpg'
Pic[15] = 'images/16.jpg'
Pic[16] = 'images/17.jpg'
Pic[17] = 'images/18.jpg'
Pic[18] = 'images/19.jpg'
Pic[19] = 'images/20.jpg'
Pic[20] = 'images/21.jpg'
Pic[21] = 'images/22.jpg'
Pic[22] = 'images/23.jpg'
Pic[23] = 'images/24.jpg'
Pic[24] = 'images/25.jpg'
Pic[25] = 'images/26.jpg'
Pic[26] = 'images/27.jpg'
Pic[27] = 'images/28.jpg'
Pic[28] = 'images/29.jpg'
Pic[29] = 'images/30.jpg'
Pic[30] = 'images/31.jpg'
// do not edit anything below this line
var t;;
var j = 0;;
var p = Pic.length;;
var preLoad = new Array();;
for (i = 0;; i 〈 p;; i++) {
preLoad[i] = new Image();;
preLoad[i].src = Pic[i];;
}
function runSlideShow() {
if (document.all) {
document.images.SlideShow.style.filter="blendTrans(duration=2)";;
document.images.SlideShow.style.filter="blendTrans(duration=crossFadeDuration)";;
document.images.SlideShow.filters.blendTrans.Apply();;
}
document.images.SlideShow.src = preLoad[j].src;;
if (document.all) {
document.images.SlideShow.filters.blendTrans.Play();;
}
j = j + 1;;
if (j 〉 (p - 1)) j = 0;;
t = setTimeout('runSlideShow()', slideShowSpeed);;
}
〈/script〉
〈script language="javascript" type="text/javascript"〉
〈!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth;; document.MM_pgH=innerHeight;; οnresize=MM_reloadPage;; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();;
}
MM_reloadPage(true);;
//--〉
〈/script〉
〈/head〉
〈body bgcolor="#FFFFFF" text="#000000" leftmargin="0" topmargin="0" onLoad="runSlideShow()"〉
〈div id="testimage" style="position:absolute;;visibility:visible;;top:0px;;left:0px;; width:622px;; height:493px;;"〉
〈object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 " width="550" height="400"〉
〈param name="movie" value="flash/0541.swf"〉
〈param name="quality" value="high"〉〈param name="wmode" value="transparent"〉
〈embed src="flash/0541.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer " type="application/x-shockwave-flash" width="550" height="400"〉〈/embed〉
〈/object〉
〈/div〉
〈table border="0" cellpadding="0" cellspacing="0"〉
〈tr〉
〈td id="VU"〉
〈img src="images/1.jpg" name='SlideShow' width=388 height=415〉
〈/td〉
〈/tr〉
〈/table〉
〈/body〉
〈/html〉
超级连接很酷的变色
〈script src="fade.js"〉〈/script〉
fade.js
Code: [Copy to clipboard]
/*************
**** 〈config〉
**/
startColor = "#000000";; // MouseOut link color
endColor = "#FFFFFF";; // MouseOver link color
stepIn = 20;; // delay when fading in
stepOut = 23;; // delay when fading out
/*
** set to true or false;; true will
** cause all links to fade automatically
***/
autoFade = true;;
/*
** set to true or false;; true will cause all CSS
** classes with "fade" in them to fade onmouseover
***/
sloppyClass = true;;
/**
**** 〈/config〉
**************/
/*************
**** 〈install〉
**
**
**** 〈/install〉
**************/
hexa = new makearray(16);;
for(var i = 0;; i 〈 10;; i++)
hexa[i] = i;;
hexa[10]="a";; hexa[11]="b";; hexa[12]="c";;
hexa[13]="d";; hexa[14]="e";; hexa[15]="f";;
document.onmouseover = domouseover;;
document.onmouseout = domouseout;;
startColor = dehexize(startColor.toLowerCase());;
endColor = dehexize(endColor.toLowerCase());;
var fadeId = new Array();;
function dehexize(Color){
var colorArr = new makearray(3);;
for (i=1;; i〈7;; i++){
for (j=0;; j〈16;; j++){
if (Color.charAt(i) == hexa[j]){
if (i%2 !=0)
colorArr[Math.floor((i-1)/2)]=eval(j)*16;;
else
colorArr[Math.floor((i-1)/2)]+=eval(j);;
}
}
}
return colorArr;;
}
function domouseover() {
if(document.all){
var srcElement = event.srcElement;;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(startColor,endColor,srcElement.uniqueID,stepIn);;
}
}
function domouseout() {
if (document.all){
var srcElement = event.srcElement;;
if ((srcElement.tagName == "A" && autoFade) || srcElement.className == "fade" || (sloppyClass && srcElement.className.indexOf("fade") != -1))
fade(endColor,startColor,srcElement.uniqueID,stepOut);;
}
}
function makearray(n) {
this.length = n;;
for(var i = 1;; i 〈= n;; i++)
this[i] = 0;;
return this;;
}
function hex(i) {
if (i 〈 0)
return "00";;
else if (i 〉 255)
return "ff";;
else
return "" + hexa[Math.floor(i/16)] + hexa[i%16];;}
function setColor(r, g, b, element) {
var hr = hex(r);; var hg = hex(g);; var hb = hex(b);;
element.style.color = "#"+hr+hg+hb;;
}
function fade(s,e, element,step){
var sr = s[0];; var sg = s[1];; var sb = s[2];;
var er = e[0];; var eg = e[1];; var eb = e[2];;
if (fadeId[0] != null && fade[0] != element){
setColor(sr,sg,sb,eval(fadeId[0]));;
var i = 1;;
while(i 〈 fadeId.length){
clearTimeout(fadeId[i]);;
i++;;
}
}
for(var i = 0;; i 〈= step;; i++) {
fadeId[i+1] = setTimeout("setColor(Math.floor(" +sr+ " *(( " +step+ " - " +i+ " )/ " +step+ " ) + " +er+ " * (" +i+ "/" +
step+ ")),Math.floor(" +sg+ " * (( " +step+ " - " +i+ " )/ " +step+ " ) + " +eg+ " * (" +i+ "/" +step+
")),Math.floor(" +sb+ " * ((" +step+ "-" +i+ ")/" +step+ ") + " +eb+ " * (" +i+ "/" +step+ ")),"+element+");;",i*step);;
}
fadeId[0] = element;;
}
最大化/最小化/关闭窗口代码集锦
在制作网页时,我们常常需要用到这类代码,很简单也很实用
最大化窗口:
〈OBJECT id="max" type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"〉
〈PARAM name="Command" value="Maximize"〉〈/OBJECT〉
〈a href="#1" οnclick="max.Click()"〉最大化〈/a〉
最小化窗口:
〈object id=minimize type="application/x-oleobject" classid="clsid:adb880a6-d8ff-11cf-9377-00aa003b7a11"〉
〈param name="Command" value="Minimize"〉〈/object〉
〈a href="#1" οnclick="minimize.Click()"〉最小化〈/a〉
关闭窗口:
〈a href="javascript:window.close()"〉关闭窗口〈/a〉
将内嵌式广告隐藏
一些免费主页空间的提供商开始将弹出式广告条改为内嵌式广告条了,笔者对这种内嵌式广告条进行分析,写出一段javascript代码,通过这段代码可以将内嵌式广告隐藏起来:
Code: [Copy to clipboard]
<div id=CTsidebar style=″Z-INDEX:15;;visibility:hidden″>
<script language=″javascript″>
showSideBarCol
showHideSidebar
function showSideBarCol
var mstrSideBarCol
mstrSideBarCol = '<div id=sidecol>'
ifnavigator.appName ==″Netscape″
document.write
else
document.write('<div>'+ mstrSideBarCol +'</div>');;
</script>
</div>
这段代码主要通过建立一个层,使用visility变量设置为hidden隐藏),用javascript将广告隐藏起来,将代码插在<boby></boby>之间(最好插在</boby>之前),保存上传,打开你的主页,广告条是不是不见了!
离开时自动提示设为首页
Code: [Copy to clipboard]
〈body οnunlοad="BASEBody.style.behavior='url(#default#homepage)';;if(! (BASEBody.isHomePage('http://eyaya.com.ru')))BASEBody.setHomePage('http: //eyaya.com.ru/');;"〉
用MYIE等多窗口浏览器进入后会弹出
是弹出一个新IE窗口来的,它的实现代码很简单
看
http://www.feing.com/qq37600367xongdi/yjj/lunwen/index.htm
Code: [Copy to clipboard]
〈script language="javascript"〉
focusid=setTimeout("focus();;window.showModelessDialog('http://www.feing.com /qq37600367xongdi/yjj /tan.htm','','scroll:0;;status:0;;help:0;;resizable:0;;dialogWidth:0px;;dialogHeight:0px')",0000)
〈/script〉
然后在http://www.feing.com/qq37600367xongdi/yjj/tan.htm 这个页面放置这个代码:
Code: [Copy to clipboard]
〈script language=javascript〉 window.open('http://eyaya.com.ru','114','resizable,menubar,scrollbars,dependent,location,toolbar,width=800,height=600');;setTimeout('window.close();;', 0);;〈/script〉
这样弹出的多页面窗口又自动关闭了,根本看不出来……
图片 向下闪缩放的效果
先保存这个为xxx.js文件放在页面的 〈head〉〈/head〉里
Code: [Copy to clipboard]
function lbsong()
{
window.open("about:blank","lbsong","toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,top=100,left=100,width=302,height=232");;
}
function open_window(url,windowname,size)
{
window.open(url,windowname,"toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=yes,top=10,left=10,"+ size);;
}
function CheckOthers(form)
{
for (var i=0;;i〈form.elements.length;;i++)
{
var e = form.elements[i];;
// if (e.name != 'chkall')
if (e.checked==false)
{
e.checked = true;;// form.chkall.checked;;
}
else
{
e.checked = false;;
}
}
}
function CheckAll(form)
{
for (var i=0;;i〈form.elements.length;;i++)
{
var e = form.elements[i];;
// if (e.name != 'chkall')
e.checked = true// form.chkall.checked;;
}
}
function on(gValue){
pic=gValue;;
move=setInterval("moving(pic)",50);;}
function off(gValue){
clearInterval(move);;
gValue.filters.blur.strength=0;; }
function moving(s){
if (s.filters.blur.strength〈110)
s.filters.blur.strength+=5;;
else clearInterval(move);;}
function makevisible(cur,which)
{
if (which==0)
cur.filters.alpha.opacity=100
else
cur.filters.alpha.opacity=40
}
然都在图片后面加上 下面的蓝色代码
〈img src="banner_13.jpg" width="760" height="120" style="border-color:#000000;;border-width:1px;;border- style:solid;;filter: blur(add=1, direction=100, strength=2)" onMouseOut="off(this)" onMouseOver="on(this)" 〉
鼠标放在图片上才显示色彩 平时是灰色的图片
〈a href="index.aspx"〉〈img id="ibHome" οnmοuseοver="removemask(this)" style="FILTER: gray alpha(opacity=50)"
οnmοuseοut="addmask(this)" src="macnew/ihome.gif" title="进入首页chr(13)&Chr(10)[Beta home]" Border="0"〉〈/a〉
Code: [Copy to clipboard]
〈SCRIPT language="javascript1.2"〉〈!--
function makevisible(cur,which){
if (which==0)
cur.filters.alpha.opacity=30
else
cur.filters.alpha.opacity=60
}
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth;; document.MM_pgH=innerHeight;; οnresize=MM_reloadPage;; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();;
}
MM_reloadPage(true);;
function addmask(ow)
{
ow.filters.gray.enabled=true;;
pWidgets(ow,50,5,5);;
//ow.style.filter="gray alpha(opacity=50)";;
}
function removemask(ow)
{
ow.filters.gray.enabled=false;;
pWidgets(ow,100,5,5);;
//ow.style.filter="";;
}
var tm;;
function addmaskicon(ow,strstat,boxstat)
{
ow.filters.gray.enabled=true;;
pWidgets(ow,50,5,5);;
boxstat.innerHTML=strstat;;
}
function removemaskicon(ow,strstat,boxstat)
{
ow.filters.gray.enabled=false;;
pWidgets(ow,100,5,5);;
boxstat.innerHTML=strstat;;
}
// --〉
〈/SCRIPT〉
同页面的超级连接不同颜色
Code:
〈html〉
〈head〉
〈style〉
a.a1:link {
font-size: 9pt;;
color: #000000;;
text-decoration: none;;
}
a.a1:visited {
font-size: 9pt;;
color: #999999;;
text-decoration: none;;
}
a.a1:hover {
font-size: 9pt;;
color: #FF6600;;
position: relative;;
top: 1px;;
}
a.a1:active {
font-size: 9pt;;
color: #333333;;
text-decoration: none;;
}
a.a2:link {
font-size: 9pt;;
color: #00ff00;;
}
a.a2:hover {
font-size: 10pt;;
color: #FF3300;;
position: relative;;
top: 5px;;
}
a.a2:active {
font-size: 9pt;;
color: #fffff;;
text-decoration: none;;
}
〈/style〉
〈meta http-equiv="Content-Type" content="text/html;; charset=gb2312"〉
〈title〉无标题文档〈/title〉
〈/head〉
〈body〉
〈center〉
chr(13)&Chr(10)
chr(13)&Chr(10)
chr(13)&Chr(10)
chr(13)&Chr(10)
〈a href="" class="a1"〉123456〈/a〉
〈a href="" class="a2"〉000000〈/a〉
〈/center〉
〈/body〉
〈/html〉