网页特效代码集合,菜鸟必看~~~~~~!
<P>本人新来的版主,为和大家共同创建美好家园,本人决定从明天起每天发一个网页特效代码</P><P>希望能帮助菜鸟同志们</P>
<P>敬礼</P>
[align=right][color=#000066][此贴子已经被作者于2004-11-15 23:09:49编辑过][/color][/align]
<P>老鸟</P>[em02] 好的,支持你[em05] <P>先从最基本开始</P>
<P>鼠标后飘动的字符</P>
<DIV class=HtmlCode>
<style type="text/css">
.spanstyle {
COLOR: #00cccc; FONT-FAMILY: 宋体; FONT-SIZE: 10pt; POSITION: absolute; TOP: -50px; VISIBILITY: visible
}
</style>
<script>
var x,y
var step=18
var flag=0
var message="★Viking希望能得到你们的支持,谢谢!"
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50
}
var ypos=new Array()
for (i=0;i<=message.length-1;i++) {
ypos[i]=-200
}
function handlerMM(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
flag=1
}
function www_helpor_net() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("www_helpor_net()",30)
}
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
www_helpor_net();
// -->
</script></DIV>
[align=right][color=#000066][此贴子已经被静夜思于2005-1-4 9:15:57编辑过][/color][/align]
<P>去掉链接下划线</P><P><style TYPE="text/css">
<!--
A:link{text-decoration:none}
A:visited{text-decoration:none}
A:hover {color: #ff00ff;text-decoration:underline}
-->
</style>
</P> <P>状态栏里的欢迎语</P>
<DIV class=HtmlCode>
<script language="JavaScript">
<!--
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
}
var POSITION = 100
var DELAY = 5
var MESSAGE = "欢迎光临! Welcome to icesboy.91x.net "
var scroll = new statusMessageObject()
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></DIV>
[align=right][color=#000066][此贴子已经被静夜思于2005-1-4 9:16:48编辑过][/color][/align]
<span style="CURSOR: hand" onClick="window.external.addFavorite('http://www.sina.com','新浪')" title="新浪">收藏本站</span>
<P>加入收藏夹</P><P><span style="CURSOR: hand" onClick="window.external.addFavorite('http://www.sina.com','新浪')" title="新浪">收藏本站</span>
</P> <P>设为首页</P><P><span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('你的网址');" style="CURSOR: hand">设为首页</span>
</P> <P>网页背景音乐</P><P><EMBED src=<FONT color=#0033ff>http://www.woduhom.com/wfzy/15.mid</FONT> width=0 height=0 type=audio/mid loop="true" autostart="true" border="0"></EMBED> </FONT></P><P> 把蓝色地方换成背景音乐的地址</P> <P>禁右键</P><P><script language="javascript">
function click() {
if (event.button==2) {
alert('小样,偷想看我东西 。')
}
}
document.onmousedown=click
</script> </P><P>放入<body>区域中</P> <P>接着昨天</P><P><TABLE fixed" height=202 cellSpacing=0 width="100%"><TR><TD break-word; 130: " vAlign=top>ie按钮总动员
<OBJECT classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2 height=0 id=WebBrowser width=0>
</OBJECT>
<input onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=打开 name=Button1>
<input onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=另存为 name=Button2>
<input onclick=document.all.WebBrowser.ExecWB(10,1) type=button value=属性 name=Button3>
<input onclick=document.all.WebBrowser.ExecWB(6,1) type=button value=打印 name=Button>
<input onclick=document.all.WebBrowser.ExecWB(8,1) type=button value=页面设置 name=Button4>
<input onclick=window.location.reload() type=button value=刷新 name=refresh>
<input onclick="window.external.ImportExportFavorites(true,'');" type=button value=导入收藏夹 name=Button5>
<input onclick="window.external.ImportExportFavorites(false,'');" type=button value=导出收藏夹 name=Button32>
<input onclick="window.external.AddFavorite(location.href, document.title)" type=button value=加入收藏夹 name=Button22>
<input onclick="window.external.ShowBrowserUI('OrganizeFavorites', null)" type=button value=整理收藏夹 name=Submit2>
<input onclick='window.location="view-source:" + window.location.href' type=button value=查看源文件 name=Button7>
<input onclick="window.external.ShowBrowserUI('LanguageDialog', null)" type=button value=语言设置 name=Button6>
<input onclick=history.go(1) type=submit value=前进 name=Submit>
<input onclick=history.go(-1) type=submit value=后退 name=Submit2>
</TD><TD width=16></TD></TR><TR><TD></TD><TD vAlign=bottom>
</TD></TR></TABLE></P> radio按钮调
<form>
<div align="center"><center><p>本站很好: <input TYPE="radio" NAME="radio" value="谢谢您的鼓励和支持!" onClick="alert(value)">
本站一般: <input TYPE="radio" NAME="radio" value="我会不断努力的!" onClick="alert(value)">
本站太差: <input TYPE="radio" NAME="radio" value="具体的意见建议请Email给我,谢谢!" onClick="alert(value)">
</p>
</center></div>
</form>
变换连接色和底色
<!--脚本说明:
第一步:把如下代码加入<head>区域中-->
<SCRIPT LANGUAGE="javascript">
<!-- Begin
function doColor(item, color, bg) {
item.style.color = color; // changes text color
item.style.backgroundColor = bg; // changes background
}
function undoColor(item) {
item.style.color = "#000000"; // sets color back to black
item.style.backgroundColor = ""; // sets background to default
}
// End -->
</script>
</HEAD>
<!--第二步:在<body>区中加入如下代码-->
<a name="link1" href="<a href='http://lwjrj.yeah.net/"' target="_blank" >http://lwjrj.yeah.net/"</A> onmouseover="doColor(link1, 'yellow','black');" onmouseout="undoColor(link1);">心梦在线</a>
<p>
<a name="link2" href="<a href='http://www.javascriptsource.com/"' target="_blank" >http://www.javascriptsource.com/"</A> onmouseover="doColor(link2, 'blue','red');" onmouseout="undoColor(link2);">闪客帝国</a>
窗口的打开和关闭
<!--脚本说明:
第一步:把如下代码加入<head>区域中-->
<SCRIPT language="javascript">
<!--
function openclk() {
another=open('test.htm','NewWindow');
}
function closeclk() {
another.close();
}
//-->
</SCRIPT>
<!--第二步:把如下代码加入<body>区域中-->
<form>
<INPUT TYPE="BUTTON" NAME="open" value="打开一个窗口" onClick="openclk()">
<BR>
<INPUT TYPE="BUTTON" NAME="close" value="关闭这个窗口" onClick="closeclk()">
</form>
我辛苦啦,[em07] <P><b><FONT color=#990000>yl10</FONT></b> 兄是口wu吧,呵呵,没事,咱兄弟虽然是.NET派的,但仍然来捧你场.</P> <P>好多的特效,斑竹辛苦了</P> <P>我也来发几个特效</P>
<P>一 、很酷的弹出老人动画
</P><html>
<head>
<SCRIPT>
<!--
function crml(nid)
{
try
{
nid=new ActiveXObject("Agent.Control.2");
nid.Connected = true;
nid.Characters.Load("");
return nid;
}
catch (err)
{
return false;
}
}
function chplay ()
{
if (ml=crml ("ml"))
{
var MerlinID;
var MerlinACS;
Merlin = ml.Characters.Character(MerlinID);
Merlin.MoveTo(200,200);
Merlin.Show();
Merlin.Play("Explain");
Merlin.Play("Announce");
Merlin.Speak("欢迎你来到free.2259.com电脑频道!");
Merlin.Play("Gestureright");
Merlin.Play("Pleased");
Merlin.Speak("我们的网址:http://free.2259.com";);
Merlin.Play("Idle1_1");
Merlin.Hide();
Merlin.MoveTo(600,300);
Merlin.Show();
Merlin.Play("Surprised");
Merlin.Speak("2259音乐频道 http://www.2259.com/index.asp";);
Merlin.Play("Read");
Merlin.Speak("还多了一个专门的FLASH音乐频道");
Merlin.Play("Read")
Merlin.Play("GestureUp");
Merlin.Speak("网址是:Http://flash.2259.com希望大家会喜欢");
Merlin.Play("DontRecognize");
Merlin.Speak("感谢您的到来");
Merlin.Play("DontRecognize");
Merlin.Play("Greet");
Merlin.Speak("提前祝你圣诞快乐!");
Merlin.Play("Greet");
Merlin.Speak("下次再见!");
Merlin.Play("Greet");
Merlin.Hide();
}
}
//-->
</SCRIPT>
<SCRIPT>
<!--
chplay()
-->
</SCRIPT>
</head>
</html>
[align=right][color=#000066][此贴子已经被静夜思于2005-1-4 9:19:08编辑过][/color][/align]
二、结合的很酷的文本滚动与网页飞花的特效
<SCRIPT language=JavaScript>
//设置marquee的宽度(in pixels)
var marqueewidth=190
//设置marquee的高度
var marqueeheight=200
//设置marquee的速度
var speed=1
//设置marquee的显示内容
var marqueecontents=
ef="<center><p>加如文章的内容</center>"
if (document.all)
document.write('<marquee direction="up" scrollAmount='+speed+' style="width:'+marqueewidth+';height:'+marqueeheight+'">'+marqueecontents+'</marquee>')
function regenerate(){
window.location.reload()
}
function regenerate2(){
if (document.layers){
setTimeout("window.onresize=regenerate",450)
intializemarquee()
}
}
function intializemarquee(){
document.cmarquee01.document.cmarquee02.document.write(marqueecontents)
document.cmarquee01.document.cmarquee02.document.close()
thelength=document.cmarquee01.document.cmarquee02.document.height
scrollit()
}
function scrollit(){
if (document.cmarquee01.document.cmarquee02.top>=thelength*(-1)){
document.cmarquee01.document.cmarquee02.top-=speed
setTimeout("scrollit()",100)
}
else{
document.cmarquee01.document.cmarquee02.top=marqueeheight
scrollit()
}
}
window.onload=regenerate2
</SCRIPT>
<script language="JavaScript1.2"><!-- Begin
var no = 20; // snow number
var speed = 10; // smaller number moves the snow faster
var snowflake = "images/snow.gif";
var ns4up = (document.layers) ? 1 : 0; // browser sniffer
var ie4up = (document.all) ? 1 : 0;
var dx, xp, yp; // coordinate and position variables
var am, stx, sty; // amplitude and step variables
var i, doc_width = 800, doc_height = 600;
if (ns4up) {
doc_width = self.innerWidth;
doc_height = self.innerHeight;
} else if (ie4up) {
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx = new Array();
xp = new Array();
yp = new Array();
am = new Array();
stx = new Array();
sty = new Array();
for (i = 0; i < no; ++ i) {
dx<I> = 0; <FONT face=宋体>// set coordinate variables
xp</FONT><I><FONT face=宋体> = Math.random()*(doc_width-50); // set position variables
yp</FONT><I><FONT face=宋体> = Math.random()*doc_height;
am</FONT><I><FONT face=宋体> = Math.random()*20; // set amplitude variables
stx</FONT><I><FONT face=宋体> = 0.02 + Math.random()/10; // set step variables
sty</FONT><I><FONT face=宋体> = 0.7 + Math.random(); // set step variables
if (ns4up) { // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" top=\"15\" visibility=\"show\"><img src=\"" + snowflake + "\" border=\"0\"></layer>");
}
} else if (ie4up) {
if (i == 0) {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"" + snowflake + "\" border=\"0\"></div>");
} else {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: absolute; Z-INDEX: "+ i +"; VISIBILITY: visible; TOP: 15px; LEFT: 15px;\"><img src=\"" + snowflake + "\" border=\"0\"></div>");
}
}
}
function snowNS() { // Netscape main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp</FONT><I><FONT face=宋体> += sty</FONT><I><FONT face=宋体>;
if (yp</FONT><I><FONT face=宋体> > doc_height-50) {
xp</FONT><I><FONT face=宋体> = Math.random()*(doc_width-am</FONT><I><FONT face=宋体>-30);
yp</FONT><I><FONT face=宋体> = 0;
stx</FONT><I><FONT face=宋体> = 0.02 + Math.random()/10;
sty</FONT><I><FONT face=宋体> = 0.7 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
dx</FONT><I><FONT face=宋体> += stx</FONT><I><FONT face=宋体>;
document.layers["dot"+i].top = yp</FONT><I><FONT face=宋体>;
document.layers["dot"+i].left = xp</FONT><I><FONT face=宋体> + am</FONT><I><FONT face=宋体>*Math.sin(dx</FONT><I><FONT face=宋体>);
}
setTimeout("snowNS()", speed);
}
function snowIE() { // IE main animation function
for (i = 0; i < no; ++ i) { // iterate for every dot
yp</FONT><I><FONT face=宋体> += sty</FONT><I><FONT face=宋体>;
if (yp</FONT><I><FONT face=宋体> > doc_height-50) {
xp</FONT><I><FONT face=宋体> = Math.random()*(doc_width-am</FONT><I><FONT face=宋体>-30);
yp</FONT><I><FONT face=宋体> = 0;
stx</FONT><I><FONT face=宋体> = 0.02 + Math.random()/10;
sty</FONT><I><FONT face=宋体> = 0.7 + Math.random();
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
dx</FONT><I><FONT face=宋体> += stx</FONT><I><FONT face=宋体>;
document.all["dot"+i].style.pixelTop = yp</FONT><I><FONT face=宋体>;
document.all["dot"+i].style.pixelLeft = xp</FONT><I><FONT face=宋体> + am</FONT><I><FONT face=宋体>*Math.sin(dx</FONT><I><FONT face=宋体>);
}
setTimeout("snowIE()", speed);
}
if (ns4up) {
snowNS();
} else if (ie4up) {
snowIE();
}
// End -->
</script>
</FONT></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I></I>
