网页特效集锦(谁能告诉我一些有用的网页特效代码啊)
在这个信息爆炸的时代,了解网页特效集锦和谁能告诉我一些有用的网页特效代码啊的重要性不言而喻。本文将为您带来全面的解读,助您在这个领域中游刃有余。
网页特效代码
在HTML文件中添加网页特效代码,一般有三种情况。
第一,只加在HTML文件头部,即HTML文件中<head>……</head>之间的代码。这类代码只需要加在这个部分,即可达到预期的效果。
第二,只加在HTML文件体部。即HTML文件中<body>……</body>之间的代码。这类代码只需要加在这个部分,即可达到预期的效果。如在你题目中提到的就属于这一类。
除上述情况外,多数代码需要先在头部(<head>……</head>之间)在上一些属性性质的代码,但是特效的主代码需要添加在体部(body>……</body>之间),否则,特效不能正常显示,有时还会出现错误,影响整个页面的正常显示。
添加特效代码的方法:
先要用HTML编辑软件,如常见的文本编辑器“记事本”,打开需要编辑的文件,根据特效代码的要求,在文件中找到相应位置,复制,粘贴特效代码,保存即可。修改完毕后,即可在浏览器中看到相应的效果。
在添加的时候一定要注意,一定要按照特效源码的要求添加,此外,还要保证源码的完整性,一个标点符号都不能少,也不能多。
另外要说的是,根据我的经验,直接从网上复制来的代码,不一定都能直接粘贴了用,一部分必须通过一个软件来中转。比如,先把网上的代码复制后,粘贴到“记事本”中,然后再复制、粘贴到相应的文件位置上。
最后,介绍你几个经典网页特效站。
1、网页特效集锦:http://www.helpor.net
2、javascript网页特效:http://www.baron.com.cn/javascript
3、万旭网页特效:http://js.wanxu.com
4、网页特效梦工厂:http://www.zlce.net/web
5、网页制作大宝库网页特效大全:http://www.dabaoku.com/texiao
谁能告诉我一些有用的网页特效代码啊
常用JS代码集锦层的隐藏与显示
只要设置style的display属性即可
比如<div style="display:none" id="MyDiv">隐藏的层</div>
如果要显示它可以通过脚本来控制
window.document.getElementById("MyDiv").style.display="";
禁止右键
<body oncontextmenu="return false">
屏蔽页面中程序运行出错信息
window.onerror= function()
{
return true;
}
得到当前显示器的分辨率
window.srceen.width得到屏幕的宽度
window.srceen.height得到屏幕的高度
如果当前分辨率为800*600,window.srceen.width是800,window.srceen.height是600
定时运行特定代码
setTimeout(Code,Timeout);
setInterval(Code,Timeout);
Code是一段字符串,里边是js代码,Timeout是时间间隔,单位是微秒
setTimeout是从现在算起多少微秒后运行该代码(只运行一次)
setInterval是每隔多少微秒运行一次代码
得到本页网址
var Url= window.location.href;
保存当前页面的内容
document.execCommand("SaveAs","","C:\\index.htm");
隐去浏览器中当鼠标移到图片上跳出的工具栏
<img galleryimg="no">
或者
<head>
<meta http-equiv="imagetoolbar" content="no">
</head>
■打开■
<input name=Button onClick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开>
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■另存为■
<input name=Button onClick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■属性■
<input name=Button onClick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■打印■
<input name=Button onClick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■页面设置■
<input name=Button onClick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置><OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0></OBJECT>
■刷新■
<input type=button value=刷新 name=refresh onclick="window.location.reload()">
■导入收藏■
<input type="button" name="Button" value="导入收藏夹" onClick=window.external.ImportExportFavorites(true,);>
■导出收藏■
<input type="button" name="Button3" value="导出收藏夹" onClick=window.external.ImportExportFavorites(false,);>
■加入收藏■
<INPUT name=Button2 onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹>
■整理收藏夹■
<INPUT name=Submit2 onclick="window.external.ShowBrowserUI(OrganizeFavorites, null)" type=button value=整理收藏夹>
■查看原文件■
<INPUT name=Button onclick=window.location="view-source:"+ window.location.href type=button value=查看源文件>
■语言设置■
<INPUT name=Button onclick="window.external.ShowBrowserUI(LanguageDialog, null)" type=button value=语言设置>
■前进■
<INPUT name=Submit onclick=history.go(1) type=submit value=前进>
■后退■
<INPUT name=Submit2 onclick=history.go(-1) type=submit value=后退>
谁帮我改下网页代码呀
<html><head></head>
<script language="JavaScript">
<!--
var bsYear;
var bsDate;
var bsWeek;
var arrLen=8;//数组长度
var sValue=0;//当年的秒数
var dayiy=0;//当年第几天
var miy=0;//月份的下标
var iyear=0;//年份标记
var dayim=0;//当月第几天
var spd=86400;//每天的秒数
var year1999="30;29;29;30;29;29;30;29;30;30;30;29";//354
var year2000="30;30;29;29;30;29;29;30;29;30;30;29";//354
var year2001="30;30;29;30;29;30;29;29;30;29;30;29;30";//384
var year2002="30;30;29;30;29;30;29;29;30;29;30;29";//354
var year2003="30;30;29;30;30;29;30;29;29;30;29;30";//355
var year2004="29;30;29;30;30;29;30;29;30;29;30;29;30";//384
var year2005="29;30;29;30;29;30;30;29;30;29;30;29";//354
var year2006="30;29;30;29;30;30;29;29;30;30;29;29;30";
var month1999="正月;二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"
var month2001="正月;二月;三月;四月;闰四月;五月;六月;七月;八月;九月;十月;十一月;十二月"
var month2004="正月;二月;闰二月;三月;四月;五月;六月;七月;八月;九月;十月;十一月;十二月"
var month2006="正月;二月;三月;四月;五月;六月;七月;闰七月;八月;九月;十月;十一月;十二月"
var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十";
var Ys=new Array(arrLen);
Ys[0]=919094400;Ys[1]=949680000;Ys[2]=980265600;
Ys[3]=1013443200;Ys[4]=1044028800;Ys[5]=1074700800;
Ys[6]=1107878400;Ys[7]=1138464000;
var Yn=new Array(arrLen);//农历年的名称
Yn[0]="己卯年";Yn[1]="庚辰年";Yn[2]="辛巳年";
Yn[3]="壬午年";Yn[4]="癸未年";Yn[5]="甲申年";
Yn[6]="乙酉年";Yn[7]="丙戌年";
var D=new Date();
var yy=D.getYear();
var mm=D.getMonth()+1;
var dd=D.getDate();
var ww=D.getDay();
if(ww==0) ww="<font color=RED>星期日";
if(ww==1) ww="星期一";
if(ww==2) ww="星期二";
if(ww==3) ww="星期三";
if(ww==4) ww="星期四";
if(ww==5) ww="星期五";
if(ww==6) ww="<font color=RED>星期六";
ww=ww;
var ss=parseInt(D.getTime()/ 1000);
if(yy<100) yy="19"+yy;
for(i=0;i<arrLen;i++)
if(ss>=Ys[i]){
iyear=i;
sValue=ss-Ys[i];//当年的秒数
}
dayiy=parseInt(sValue/spd)+1;//当年的天数
var dpm=year1999;
if(iyear==1) dpm=year2000;
if(iyear==2) dpm=year2001;
if(iyear==3) dpm=year2002;
if(iyear==4) dpm=year2003;
if(iyear==5) dpm=year2004;
if(iyear==6) dpm=year2005;
if(iyear==7) dpm=year2006;
dpm=dpm.split(";");
var Mn=month1999;
if(iyear==2) Mn=month2001;
if(iyear==5) Mn=month2004;
if(iyear==7) Mn=month2006;
Mn=Mn.split(";");
var Dn="初一;初二;初三;初四;初五;初六;初七;初八;初九;初十;十一;十二;十三;十四;十五;十六;十七;十八;十九;二十;廿一;廿二;廿三;廿四;廿五;廿六;廿七;廿八;廿九;三十";
Dn=Dn.split(";");
dayim=dayiy;
var total=new Array(13);
total[0]=parseInt(dpm[0]);
for(i=1;i<dpm.length-1;i++) total[i]=parseInt(dpm[i])+total[i-1];
for(i=dpm.length-1;i>0;i--)
if(dayim>total[i-1]){
dayim=dayim-total[i-1];
miy=i;
}
bsWeek=ww;
bsDate=yy+"年"+mm+"月";
bsDate2=dd;
bsYear="农历"+Yn[iyear];
bsYear2=Mn[miy]+Dn[dayim-1];
if(ss>=Ys[7]||ss<Ys[0]) bsYear=Yn[7];
function CAL(){
document.write("<table border='1' cellspacing='3' width='155' bordercolor='#000000' bgcolor='#FFFFFF' height='110' cellpadding='2'");
document.write("<tr><td align='center'><b><font color=#008040>"+bsDate+"</font><br><font face='Arial' size='6' color=#FF8040>"+bsDate2+"</font><br><font color=#008040><span style='FONT-SIZE: 10.5pt'>");
document.write(bsWeek+"</span><br>"+"<br></b><font color=#9B4E00>");
document.write(bsYear+"<br>"+bsYear2+"</td></tr></table>");
}
//-->
function www_helpor_net()
{
var Digital=new Date()
var hours=Digital.getHours()
var minutes=Digital.getMinutes()
var seconds=Digital.getSeconds()
if(minutes<=9)
minutes="0"+minutes
if(seconds<=9)
seconds="0"+seconds
myclock="现在时刻:<font size='5' face='Arial black'>"+hours+":"+minutes+":"+seconds+"</font>"
if(document.layers){document.layers.liveclock.document.write(myclock)
document.layers.liveclock.document.close()
}else if(document.all)
liveclock.innerHTML=myclock
setTimeout("www_helpor_net()",1000)
}
//跳转搜索页
function search4()
{if(form1.abc0.checked)
window.open("http://search.sina.com.cn/cgi-bin/search/search.cgi?_searchkey="+form1.key.value,"mspg0");if(form1.abc1.checked)
window.open("http://site.search.sohu.com/sitesearch.jsp?page_index=0&key_word="+form1.key.value,"mspg1");if(form1.abc2.checked)
window.open("http://cn.search.yahoo.com/search/cn?p="+form1.key.value,"mspg2");if(form1.abc3.checked)
window.open("http://www.skycn.com/search.php?sor=00&ss_name="+form1.key.value,"mspg3");if(form1.abc4.checked)
window.open("http://www.google.com/search?hl=zh-CN&inlang=zh-CN&ie=GB2312&oe=GB2312&q="+form1.key.value,"mspg4");if(form1.abc5.checked)
window.open("http://search.yahoo.com/bin/search?p="+form1.key.value,"mspg5");if(form1.abc6.checked)
window.open("http://www.baidu.com/s?tn=sitesowang&word="+form1.key.value,"mspg6");if(form1.abc7.checked)
window.open("http://mp3search.baidu.com/wstsearch?tn=baidump3&ct=134217728&lm=-1&rn=&word="+form1.key.value,"mspg7");if(form1.abc8.checked)
window.open("http://search.sogua.com/search/search.asp?fmp3=1&frm=1&fwma=1&fasf=1&go.x=25&go.y=19&key="+form1.key.value,"mspg8");if(form1.abc9.checked)
window.open("http://mp3search.baidu.com/wstsearch?tn=baidump3lyric&ct=150994944&lm=-1&rn=&word="+form1.key.value,"mspg9");if(form1.abc10.checked)
window.open("http://pic.sina.com.cn/cgi-bin/retr/search?query="+form1.key.value,"mspg10");if(form1.abc11.checked)
window.open("http://www.baidu.com/i?ct=201326592&cl=2&lm=-1&tn=baiduimage&word="+form1.key.value,"mspg11");if(form1.abc12.checked)
window.open("http://bingle.pku.edu.cn/scripts/ftp_search.exe?cdtype=GB&word="+form1.key.value,"mspg12");if(form1.abc13.checked)
window.open("http://flash.zhongsou.com/zsflash.cgi?myselectvalue=2&tn=flash&ct=33554432&lm=&word="+form1.key.value,"mspg13");if(form1.abc14.checked)
window.open("http://www.yisou.com/search?p="+form1.key.value,"mspg14");return false;}
function colors(c1){
this.c1= c1;
}
a00= new colors("FFFBD0");
a01= new colors("FF0000");
a02= new colors("FF8080");
a03= new colors("FF8000");
a04= new colors("FFFF00");
a05= new colors("000080");
a06= new colors("0000FF");
a07= new colors("008000");
a08= new colors("00FF00");
a09= new colors("804000");
a10= new colors("808000");
a11= new colors("000000");
a12= new colors("FFFFFF");
a13= new colors("C0C0C0");
a14= new colors("408080");
a15= new colors("808080");
a16= new colors("D2BF51");
a17= new colors("44BBE8");
a18= new colors("C97AB9");
a19= new colors("A2C97A");
a20= new colors("6AE6C4");
a21= new colors("C0DCB8");
a22= new colors("33A3D1");
a23= new colors("6C9AEE");
function changebg(type){
scheme= type;
document.bgColor= scheme.c1;
timerID=setTimeout('document.bgColor= scheme.c2',
document.selector.value* 10);
}
</script>
<body>
<table width=98% height=64 border=0 align="center" cellpadding=0 cellspacing=0 bordercolor=#99DF95 bgcolor=#F0F7FF>
<tr><td width=726 height=3 class="f9" colspan="2"><p align=center><br>综合搜索<br><br></td></tr>
<tr><td height=50 class="f9" colspan="2">
<form name=form1 onsubmit=return(search4())>
<div align=center><center><p><B><font color=#000000>关键字:</font></B>
<input type=text name=key size=20>
<input type=submit style=COLOR: rgb(0,0,0);FONT-SIZE: 9pt value=搜索 name=B2><input type=checkbox name=abc0 value=sina><a href=http://iask.com/ class="mm">新浪</a>
<input type=checkbox name=abc1 value=sohu><a
href=http://www.sogou.com/ class="mm">搜狐</a>
<input type=checkbox name=abc2 value=yahoo><a
href=http://www.yisou.com/ class="mm">雅虎</a>
<input type=checkbox name=abc3 value=yeah><a
href=http://www.sowang.com/free/down.htm class="mm">软件</a>
<input type=checkbox name=abc4 value=3721><a
href=http://www.sowang.com/googleseaech.htm class="mm">google</a>
<input type=checkbox name=abc5 value=yahooe><a
href=http://www.yahoo.com class="mm">Yahoo</a>
<input type=checkbox name=abc6 value=google checked><a
href=http://chinabaidu.com/ class="mm">百度</a>
<input type=checkbox name=abc7 value=baidump3>
<span class="mm"><a
href=http://mp3.baidu.com/ class="mm">百度mp3</a></span><font
color=#008000></font>
<input type=checkbox name=abc8
value=baidump3><a href=http://www.sogua.com/ class="mm">搜刮mp3</a><input type=checkbox name=abc9
value=baidump3>歌词<input type=checkbox name=abc10 value=baidump3><a
href=http://p.iask.com/ class="mm">新浪图片</a><input type=checkbox name=abc11
value=baidump3><a href=http://image.baidu.com/ class="mm">百度图片</a><input type=checkbox
name=abc12 value=baidump3><a href=http://www.mytianwang.cn/ class="mm">天网搜索</a><input
type=checkbox name=abc13 value=baidump3><a href=http://mp3.baidu.com/m?f=ms&rn=&tn=baidump3&ct=134217728&word=&submit=%B0%D9%B6%C8%CB%D1%CB%F7&lm=6 class="mm">FLASH</a><input
type=checkbox name=abc14 value=baidump3><a href=http://www.yisou.com/ class="mm">一搜</a><p></p></td></tr><tr><td align="center"><script language="javascript">CAL();</script><span id="liveclock" style"=width: 109px; height: 15px"></span>
<SCRIPT language=javascript>
www_helpor_net();
//-->
</SCRIPT></td><td>
<span style="CURSOR: hand" onClick="window.external.addFavorite('http://www.helpor.net','网页特效集锦')" title="网页特效集锦">收藏本站到收藏夹</span>
<span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.helpor.net');" style="CURSOR: hand">设为首页</span>
<pre>
</pre>
</center></div></form>
</td></tr><tr>
<td></td><td>
背景颜色:
<FORM name=selector>
<INPUT style="BACKGROUND-COLOR: rgb(255,251,208)" onclick=changebg(a00) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(255,0,0)" onclick=changebg(a01) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(255,128,128)" onclick=changebg(a02) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(255,128,0)" onclick=changebg(a03) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(255,255,0)" onclick=changebg(a04) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(0,0,128)" onclick=changebg(a05) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(0,0,255)" onclick=changebg(a06) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(0,128,0)" onclick=changebg(a07) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(0,255,0)" onclick=changebg(a08) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(128,0,0)" onclick=changebg(a09) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(128,128,0)" onclick=changebg(a10) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(0,0,0)" onclick=changebg(a11) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(255,255,255)" onclick=changebg(a12) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(192,192,192)" onclick=changebg(a13) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(64,128,128)" onclick=changebg(a14) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(128,128,128)" onclick=changebg(a15) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(210,191,81)" onclick=changebg(a16) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(68,187,232)" onclick=changebg(a17) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(201,122,185)" onclick=changebg(a18) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(162,201,122)" onclick=changebg(a19) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(106,230,196)" onclick=changebg(a20) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(192,220,184)" onclick=changebg(a21) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(51,163,209)" onclick=changebg(a22) type=button>
<INPUT style="BACKGROUND-COLOR: rgb(108,154,238)" onclick=changebg(a23) type=button>
</FORM>
</td></tr></table>
</body>
</html>
文章到此结束,希望我们对于网页特效集锦的问题能够给您带来一些启发和解决方案。如果您需要更多信息或者有其他问题,请随时联系我们。