注册 登录  
 加关注
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

阿龙博客

海阔凭鱼跃 天高任鸟飞

 
 
 

日志

 
 

网页特效代码  

2007-11-14 10:44:25|  分类: 代码大全 |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |


                                                         网 页 特 效 代 码

01、加入收藏夹 02、设为首页 03、自动关闭窗口 04、跳出小窗口 05、固定字号大小
06、文本向上循环滚动 07、舞台光柱照射效果 08、百页窗效果 09、文本自动向上滚动 10、字符慢慢隐现
11、文字从天而降 12、百页窗效果 13、滚动的文字说明 14、图片跟随着鼠标 15、飘动字符跟随鼠标
16、数字时钟 17、六种风格的时间 18、显示停留的时间 19、有影子的数字时钟 20、全中文日期显示
21、打字效果 22、文字从右往左移动 23、图象大小自动变化 24、漫天飞雪 25、图片渐渐显隐
26、图片渐渐显示 27、自由移动的图片 28、随鼠标触碰而变化 29、javascript的容错脚本 
1、收藏本站
  说明 点击即可把你的网站添加到浏览器的收藏菜单下 
  代码 
<span style="CURSOR: hand" onClick="window.external.addFavorite('http://zhanglong2006cn.blog.163.com','阿龙博客')" title="阿龙博客">收藏本站</span>
2、设为首页
  说明 点击即可把你的网站设置为浏览器的起始页  
  代码 
<span onclick="var strHref=window.location.href;this.style.behavior='url(#default#homepage)';this.setHomePage('http://zhanglong2006cn.blog.163.com');" style="CURSOR: hand">设为首页</span>
3、自动关闭窗口
  说明 在网页源代码中加入下面的代码,则该窗口将在20秒钟之后自动关闭!这与跳出式小窗口配合使用是再好不过啦!代码中“i=20”表示关闭的延迟时间为20秒,可任意修改。  
  代码 
<script language="javascript">
<!--
function clock(){i=i-1
document.title="本窗口将在"+i+"秒后自动关闭!";
if(i>0)setTimeout("clock();",1000);
else self.close();}
var i=20
clock();
//-->
</script>
4、跳出小窗口
  说明 在打开有下面这段代码的页面时将会跳出一个468x60大小的小窗口。“window.html”为跳出的小窗口里所要显示的网页。toolbar、status、menubar、scrollbars、设置小窗口的工具栏、状态栏、菜单栏及滚动条的有无,resizable设置是否可让浏览者改变小窗口大小,width、height设置小窗口的宽度以及高度。(不过这样的小窗口一般是不受欢迎的哦!)  
  代码 
<script language="JavaScript">
window.open("window.html","www_helpor_net","toolbar=no, status=no,menubar=no, scrollbars=no,resizable=no,width=468,height=60,left=200,top=50");
</script>
5、固定字号大小
  说明 你是否有过这样的经历:一个布置得很好的网页,当浏览时把浏览器的字号设置成大或小时,漂亮的网页马上面目全非了。因为字的大小变了,版式自然乱了。现在好了,只要把下面这段代码加入到网页源文件的<head>与</head>之间就行了(对用<font>标签定义的文字无效)。 
  代码 
<style type="text/css">
<!--
body {font-size:9pt}
td {font-size:9pt}
-->
</style>
6、文本自动向上循环滚动
  说明: 文本自动向上循环滚动,鼠标放到上面还会暂时停下来。  
  代码:
<table border="1" bordercolor="#000000" bgcolor="#6699ff" cellpadding="5" cellspacing="0">
<tr>
<td>
<script language=javascript>

document.write ("<marquee scrollamount='1' scrolldelay='30' direction= 'UP' width='200' id='helpor_net' height='150' onmouseover='helpor_net.stop()' onmouseout='helpor_net.start()' Author:redriver; For more,visit:www.helpor.net>")

document.write ("<h2><p align='center'><font color='#ffffff' face='黑体'>偶 然</font></h2>")
document.write ("<p align='right'><a href='#' target='_blank'><font color='#ffffff'>徐志摩</font></a> ")
document.write ("<p><font color='#ffffff'> ")
document.write ("<br>我是天空里的一片云,")
document.write ("<br>偶尔投影在你的波心—— ")
document.write ("<br>你不必讶异, ")
document.write ("<br>更无须欢喜—— ")
document.write ("<br>在转瞬间消灭了踪影。")
document.write ("<br>")
document.write ("<br>你我相逢在黑暗的海上,")
document.write ("<br>你有你的,我有我的,方向;")
document.write ("<br>你记得也好, ")
document.write ("<br>最好你忘掉, ")
document.write ("<br>在这交会时互放的光亮! ")
document.write ("</font>")

document.write ("</marquee> ")
</script>
</td>
</tr>
</table>
7、舞台光柱照射的效果 
  说明: 页面产生舞台光柱照射的效果  
  代码: 
<body bgcolor="#000000" id="www_helpor_net" style="position: relative; left: 0px; color: White; filter: light">

<script language="VBScript">
Option Explicit
sub window_OnLoad()
call www_helpor_net.filters.light(0).addambient(0,0,255,30)
call www_helpor_net.filters.light(0).addcone(400,400,200,100,100,200,204,200,80,10)
end sub

sub document_onMouseMove()
call www_helpor_net.filters.light(0).MoveLight(1,window.event.x,window.event.y,0,1)
end sub
</script>
8、百页窗的效果
  说明 进入页面时,页面产生百页窗似的的效果 
  代码 
<style>
<!--
.helpor_net{position:absolute;
left:0;
top:0;
layer-background-color:#3399ff;
background-color:#3399ff;
border:0.1px solid green
}
-->
</style>

<div id="i1" class="helpor_net"></div><div id="i2" class="helpor_net"></div><div id="i3"
class="helpor_net"></div><div id="i4" class="helpor_net"></div><div id="i5" class="helpor_net"></div><div
id="i6" class="helpor_net"></div><div id="i7" class="helpor_net"></div><div id="i8" class="helpor_net"></div>

<SCRIPT language=javascript>
<!--
var speed=30
var temp=new Array()
var temp2=new Array()
if (document.layers){
for (i=1;i<=8;i++){
temp[i]=eval("document.i"+i+".clip")
temp2[i]=eval("document.i"+i)
temp[i].width=window.innerWidth/8-0.3
temp[i].height=window.innerHeight
temp2[i].left=(i-1)*temp[i].width
}
}
else if (document.all){
var clipbottom=document.body.offsetHeight,cliptop=0
for (i=1;i<=8;i++){
temp[i]=eval("document.all.i"+i+".style")
temp[i].width=document.body.clientWidth/8
temp[i].height=document.body.offsetHeight
temp[i].left=(i-1)*parseInt(temp[i].width)
}
}
function openit(){
window.scrollTo(0,0)
if (document.layers){
for (i=1;i<=8;i=i+2)
temp[i].bottom-=speed
for (i=2;i<=8;i=i+2)
temp[i].top+=speed
if (temp[2].top>window.innerHeight)
clearInterval(stopit)
}
else if (document.all){
clipbottom-=speed
for (i=1;i<=8;i=i+2){
temp[i].clip="rect(0 auto+"+clipbottom+" 0)"
}
cliptop+=speed
for (i=2;i<=8;i=i+2){
temp[i].clip="rect("+cliptop+" auto auto)"
}
if (clipbottom<=0)
clearInterval(stopit)
}
}
function www_helpor_net(){
stopit=setInterval("openit()",100)
}
www_helpor_net()

-->


</SCRIPT>
9、文本自动向上循环滚动
  说明: 文本自动向上循环滚动,鼠标放到上面还会暂时停下来。 
  代码:
<DIV class=ttl1 id=ttl0><SPAN class=ttl1></SPAN></DIV>
<SCRIPT language="JavaScript">
<!--

var layers = document.layers, style = document.all, both = layers || style, idme=908601;
if (layers) { layerRef = 'document.layers'; styleRef = ''; } if (style) { layerRef = 'document.all'; styleRef = '.style'; }

function writeOnText(obj, str) {
if (layers) with (document[obj]) { document.open(); document.write(str); document.close(); }
if (style) eval(obj+'.innerHTML= str');
}
//以下是输出的内容,自己修改即可。
var dispStr = new Array(
"<font color=red size=3>欢迎光临...</font>"
);

var overMe=0;

function helpor_net(str, idx, idObj, spObj, clr1, clr2, delay, plysnd) {
var tmp0 = tmp1 = '', skip = 0;
if (both && idx <= str.length) {
if (str.charAt(idx) == '<') { while (str.charAt(idx) != '>') idx++; idx++; }
if (str.charAt(idx) == '&' && str.charAt(idx+1) != ' ') { while (str.charAt(idx) != ';') idx++; idx++; }
tmp0 = str.slice(0,idx);
tmp1 = str.charAt(idx++);

if (overMe==0 && plysnd==1) {
if (navigator.plugins[0]) {
if (navigator.plugins["LiveAudio"][0].type=="audio/basic" && navigator.javaEnabled()) {
document.embeds[0].stop();
setTimeout("document.embeds[0].play(false)",100); }
} else if (document.all) {
ding.Stop();
setTimeout("ding.Run()",100);
}
overMe=1;
} else overMe=0;

writeOnText(idObj, "<span class="+spObj+"><font color='"+clr1+"'>"+tmp0+"</font><font color='"+clr2+"'>"+tmp1+"</font></span>");
setTimeout("helpor_net('"+str+"', "+idx+", '"+idObj+"', '"+spObj+"', '"+clr1+"', '"+clr2+"', "+delay+" ,"+plysnd+")",delay);
}
}

function www_helpor_net() {
helpor_net(dispStr[0], 0, 'ttl0', 'ttl1', '#339933', '#99FF33', 50, 0);
}
www_helpor_net();
// -->
</SCRIPT>
10、字符慢慢隐现 
  说明: 字符慢慢隐现 
  代码:
<body bgcolor="#FFFFFF" id="www_helpor_net">
<div id="helpor_net" style="visibility:visible;width:400px;height:30px;text-align:center; font-family:隶书;font-size:30pt;color:6699ff"></div>

<SCRIPT language="JavaScript">
<!--
var thissize=20
var textfont="隶书"

var textcolor= new Array()
textcolor[0]="000000"
textcolor[1]="000000"
textcolor[2]="000000"
textcolor[3]="111111"
textcolor[4]="222222"
textcolor[5]="333333"
textcolor[6]="444444"
textcolor[7]="555555"
textcolor[8]="666666"
textcolor[9]="777777"
textcolor[10]="888888"
textcolor[11]="999999"
textcolor[12]="aaaaaa"
textcolor[13]="bbbbbb"
textcolor[14]="cccccc"
textcolor[15]="dddddd"
textcolor[16]="eeeeee"
textcolor[17]="ffffff"
textcolor[18]="ffffff"

var message = new Array()
message[0]="欢迎光临、、、、、、"
message[1]="多停留一会儿"
message[2]="你会有更多的收获"
message[3]="请再次光临"
i_message=0

var i_strength=0
var i_message=0
var timer

function www_helpor_net() {
if(document.all) {
if (i_strength <=17) {
helpor_net.innerText=message[i_message]
document.all.helpor_net.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"
i_strength++
timer=setTimeout("www_helpor_net()",100)
}
else {
clearTimeout(timer)
setTimeout("dewww_helpor_net()",1500)
}
}
}

function dewww_helpor_net() {
if(document.all) {
if (i_strength >=0) {
helpor_net.innerText=message[i_message]
document.all.helpor_net.style.filter="glow(color="+textcolor[i_strength]+", strength=4)"
i_strength--
timer=setTimeout("dewww_helpor_net()",100)
}
else {
clearTimeout(timer)
i_message++
if (i_message>=message.length) {i_message=0}
i_strength=0
intermezzo()
}
}
}

function intermezzo() {
helpor_net.innerText=""
setTimeout("www_helpor_net()",1000)
}
www_helpor_net();
//-->
</SCRIPT>
11、文字从天而降
  说明: 文字从页面顶部掉下来  
  代码:
<p www_helpor_net="dropWord" style="position: relative !important; left: 10000 !important" align="center"><font size="3" color="#ee00FF">哇! 有 没 有 吓 着 你 啊 ?</font><font size="7" face="Arial" color="#FF0000"><b>YES!</b></font></p>

<SCRIPT language="JavaScript">
<!--
dynamicanimAttr = "www_helpor_net"
animateElements = new Array()
currentElement = 0
speed = 0
stepsZoom = 8
stepsWord = 8
stepsFly = 12
stepsSpiral = 16
steps = stepsZoom
step = 0
outString = ""
function helpor_net()
{
var ms = navigator.appVersion.indexOf("MSIE")
ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4)
if(!ie4)
{
if((navigator.appName == "Netscape") &&
(parseInt(navigator.appVersion.substring(0, 1)) >= 4))
{
for (index=document.layers.length-1; index >= 0; index--)
{
layer=document.layers[index]
if (layer.left==10000)
layer.left=0
}
}
return
}
for (index=document.all.length-1; index >= document.body.sourceIndex; index--)
{
el = document.all[index]
animation = el.getAttribute(dynamicanimAttr, false)
if(null != animation)
{
if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
{
ih = el.innerHTML
outString = ""
i1 = 0
iend = ih.length
while(true)
{
i2 = startWord(ih, i1)
if(i2 == -1)
i2 = iend
outWord(ih, i1, i2, false, "")
if(i2 == iend)
break
i1 = i2
i2 = endWord(ih, i1)
if(i2 == -1)
i2 = iend
outWord(ih, i1, i2, true, animation)
if(i2 == iend)
break
i1 = i2
}
document.all[index].innerHTML = outString
document.all[index].style.posLeft = 0
document.all[index].setAttribute(dynamicanimAttr, null)
}
if(animation == "zoomIn" || animation == "zoomOut")
{
ih = el.innerHTML
outString = "<SPAN " + dynamicanimAttr + "=\"" + animation + "\" style=\"position: relative; left: 10000;\">"
outString += ih
outString += "</SPAN>"
document.all[index].innerHTML = outString
document.all[index].style.posLeft = 0
document.all[index].setAttribute(dynamicanimAttr, null)
}
}
}
i = 0
for (index=document.body.sourceIndex; index < document.all.length; index++)
{
el = document.all[index]
animation = el.getAttribute(dynamicanimAttr, false)
if (null != animation)
{
if(animation == "flyLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = 0
}
else if(animation == "flyRight")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = 0
}
else if(animation == "flyTop" || animation == "dropWord")
{
el.style.posLeft = 0
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyBottom")
{
el.style.posLeft = 0
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "flyTopLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyTopRight" || animation == "flyTopRightWord")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "flyBottomLeft")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "flyBottomRight" || animation == "flyBottomRightWord")
{
el.style.posLeft = 10000-offsetLeft(el)+document.body.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)+document.body.offsetHeight
}
else if(animation == "spiral")
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = document.body.scrollTop-offsetTop(el)-el.offsetHeight
}
else if(animation == "zoomIn")
{
el.style.posLeft = 10000
el.style.posTop = 0
}
else if(animation == "zoomOut")
{
el.style.posLeft = 10000
el.style.posTop = 0
}
else
{
el.style.posLeft = 10000-offsetLeft(el)-el.offsetWidth
el.style.posTop = 0
}
el.initLeft = el.style.posLeft
el.initTop = el.style.posTop
animateElements[i++] = el
}
}
window.setTimeout("animate();", speed)
}
function offsetLeft(el)
{
x = el.offsetLeft
for (e = el.offsetParent; e; e = e.offsetParent)
x += e.offsetLeft;
return x
}
function offsetTop(el)
{
y = el.offsetTop
for (e = el.offsetParent; e; e = e.offsetParent)
y += e.offsetTop;
return y
}
function startWord(ih, i)
{
for(tag = false; i < ih.length; i++)
{
c = ih.charAt(i)
if(c == '<')
tag = true
if(!tag)
return i
if(c == '>')
tag = false
}
return -1
}
function endWord(ih, i)
{
nonSpace = false
space = false
while(i < ih.length)
{
c = ih.charAt(i)
if(c != ' ')
nonSpace = true
if(nonSpace && c == ' ')
space = true
if(c == '<')
return i
if(space && c != ' ')
return i
i++
}
return -1
}
function outWord(ih, i1, i2, dyn, anim)
{
if(dyn)
outString += "<SPAN " + dynamicanimAttr + "=\"" + anim + "\" style=\"position: relative; left: 10000;\">"
outString += ih.substring(i1, i2)
if(dyn)
outString += "</SPAN>"
}
function animate()
{
el = animateElements[currentElement]
animation = el.getAttribute(dynamicanimAttr, false)
step++
if(animation == "spiral")
{
steps = stepsSpiral
v = step/steps
rf = 1.0 - v
t = v * 2.0*Math.PI
rx = Math.max(Math.abs(el.initLeft), 200)
ry = Math.max(Math.abs(el.initTop), 200)
el.style.posLeft = Math.ceil(-rf*Math.cos(t)*rx)
el.style.posTop = Math.ceil(-rf*Math.sin(t)*ry)
}
else if(animation == "zoomIn")
{
steps = stepsZoom
el.style.fontSize = Math.ceil(50+50*step/steps) + "%"
el.style.posLeft = 0
}
else if(animation == "zoomOut")
{
steps = stepsZoom
el.style.fontSize = Math.ceil(100+200*(steps-step)/steps) + "%"
el.style.posLeft = 0
}
else
{
steps = stepsFly
if(animation == "dropWord" || animation == "flyTopRightWord" || animation == "flyBottomRightWord")
steps = stepsWord
dl = el.initLeft / steps
dt = el.initTop / steps
el.style.posLeft = el.style.posLeft - dl
el.style.posTop = el.style.posTop - dt
}
if (step >= steps)
{
el.style.posLeft = 0
el.style.posTop = 0
currentElement++
step = 0
}
if(currentElement < animateElements.length)
window.setTimeout("animate();", speed)
}
helpor_net()
//-->
</SCRIPT>
12、百页窗效果
  说明: 进入页面时,页面产生百页窗似的的效果 
  代码:
<style>
<!--
.helpor_net{position:absolute;
left:0;
top:0;
layer-background-color:#3399ff;
background-color:#3399ff;
border:0.1px solid green
}
-->
</style>

<div id="i1" class="helpor_net"></div><div id="i2" class="helpor_net"></div><div id="i3"
class="helpor_net"></div><div id="i4" class="helpor_net"></div><div id="i5" class="helpor_net"></div><div
id="i6" class="helpor_net"></div><div id="i7" class="helpor_net"></div><div id="i8" class="helpor_net"></div>

<SCRIPT language=javascript>
<!--
var speed=30
var temp=new Array()
var temp2=new Array()
if (document.layers){
for (i=1;i<=8;i++){
temp[i]=eval("document.i"+i+".clip")
temp2[i]=eval("document.i"+i)
temp[i].width=window.innerWidth/8-0.3
temp[i].height=window.innerHeight
temp2[i].left=(i-1)*temp[i].width
}
}
else if (document.all){
var clipbottom=document.body.offsetHeight,cliptop=0
for (i=1;i<=8;i++){
temp[i]=eval("document.all.i"+i+".style")
temp[i].width=document.body.clientWidth/8
temp[i].height=document.body.offsetHeight
temp[i].left=(i-1)*parseInt(temp[i].width)
}
}
function openit(){
window.scrollTo(0,0)
if (document.layers){
for (i=1;i<=8;i=i+2)
temp[i].bottom-=speed
for (i=2;i<=8;i=i+2)
temp[i].top+=speed
if (temp[2].top>window.innerHeight)
clearInterval(stopit)
}
else if (document.all){
clipbottom-=speed
for (i=1;i<=8;i=i+2){
temp[i].clip="rect(0 auto+"+clipbottom+" 0)"
}
cliptop+=speed
for (i=2;i<=8;i=i+2){
temp[i].clip="rect("+cliptop+" auto auto)"
}
if (clipbottom<=0)
clearInterval(stopit)
}
}
function www_helpor_net(){
stopit=setInterval("openit()",100)
}
www_helpor_net()

-->


</SCRIPT>
13、有滚动的文字说明 
  说明:鼠标放到链接上就会出现一个说明框,里面有滚动的文字说明 
  代码:
<a href="http://www.helpor.net" target="_blank" onMouseOver="helpor_net_show(this,event,'看到了吧?')" onMouseOut="helpor_net_hide()">把鼠标放上来试试</a>
<div id="tooltip2" style="position:absolute;visibility:hidden;clip:rect(0 150 50 0);width:150px;background-color:seashell">
<layer name="nstip" width="1000px" bgColor="seashell"></layer>
</div>
<SCRIPT language="JavaScript">
<!--
if (!document.layers&&!document.all)
event="test"
function helpor_net_show(current,e,text){

if (document.all&&document.readyState=="complete"){
document.all.tooltip2.innerHTML='<marquee style="border:1px solid #3399ff">'+text+'</marquee>'
document.all.tooltip2.style.pixelLeft=event.clientX+document.body.scrollLeft+10
document.all.tooltip2.style.pixelTop=event.clientY+document.body.scrollTop+10
document.all.tooltip2.style.visibility="visible"
}

else if (document.layers){
document.tooltip2.document.nstip.document.write('<b>'+text+'</b>')
document.tooltip2.document.nstip.document.close()
document.tooltip2.document.nstip.left=0
currentscroll=setInterval("scrolltip()",100)
document.tooltip2.left=e.pageX+10
document.tooltip2.top=e.pageY+10
document.tooltip2.visibility="show"
}
}
function helpor_net_hide(){
if (document.all)
document.all.tooltip2.style.visibility="hidden"
else if (document.layers){
clearInterval(currentscroll)
document.tooltip2.visibility="hidden"
}
}

function scrolltip(){
if (document.tooltip2.document.nstip.left>=-document.tooltip2.document.nstip.document.width)
document.tooltip2.document.nstip.left-=5
else
document.tooltip2.document.nstip.left=150
}
//-->
</SCRIPT>
14、图片跟随着鼠标
  说明:图片跟随着鼠标,最好把图片做成透明的,那样效果更好 
  代码:
<SCRIPT LANGUAGE="JavaScript">
var image="../images/helpor.gif"
var newtop=15
var newleft=15
if (navigator.appName == "Netscape") {
layerStyleRef="layer.";
layerRef="document.layers";
styleSwitch="";
}
else
{
layerStyleRef="layer.style.";
layerRef="document.all";
styleSwitch=".style";
}

function helpor_net() {

layerName = 'iit'

eval('var curElement='+layerRef+'["'+layerName+'"]')
eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"')
eval('curElement'+styleSwitch+'.visibility="visible"')
eval('newleft=document.body.clientWidth-curElement'+styleSwitch+'.pixelWidth')
eval('newtop=document.body.clientHeight-curElement'+styleSwitch+'.pixelHeight')
eval('height=curElement'+styleSwitch+'.height')
eval('width=curElement'+styleSwitch+'.width')
width=parseInt(width)
height=parseInt(height)
if (event.clientX > (document.body.clientWidth - 5 - width))
{
newleft=document.body.clientWidth + document.body.scrollLeft - 5 - width
}
else
{
newleft=document.body.scrollLeft + event.clientX
}
eval('curElement'+styleSwitch+'.pixelLeft=newleft')

if (event.clientY > (document.body.clientHeight - 5 - height))
{
newtop=document.body.clientHeight + document.body.scrollTop - 5 - height
}
else
{
newtop=document.body.scrollTop + event.clientY
}
eval('curElement'+styleSwitch+'.pixelTop=newtop')
}

document.onmousemove = helpor_net;

if (navigator.appName == "Netscape") {

}
else
{
document.write('<div ID="OuterDiv">')
document.write('<img ID="iit" src="'+image+'" STYLE="position:absolute;TOP:20pt;LEFT:20pt;Z-INDEX:20;visibility:hidden;">')
document.write('</div>')
}
</script>
15、飘动的字符跟鼠标
  说明 在鼠标后面跟着一串飘动的字符  
  代码 
<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="★欢迎你的光临!"

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>
16、数字时钟
  说明 数字化的时钟 
  代码 
<span id="liveclock" style"=width: 109px; height: 15px"></span>
<SCRIPT language=javascript>
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)
}
www_helpor_net();
//-->
</SCRIPT>
17、六种风格时间
  说明: 六种风格时间显示,一定有你喜欢的! 
  效果: 风格一: 星期二,6月1日,2004年 
  风格二: 7:56:28上午 
  风格三: 星期二,6月1日,2004年 7:56:28上午 
  风格四: 6/1/04 
  风格五: 7:56:28 
  风格六: Tue Jun 1 07:56:28 UTC+0800 2004 
  代码: 
<SCRIPT language="javascript">
<!--
function initArray()
{
for(i=0;i<initArray.arguments.length;i++)
this[i]=initArray.arguments[i];
}
var isnMonths=new initArray("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月");
var isnDays=new initArray("星期日","星期一","星期二","星期三","星期四","星期五","星期六","星期日");
today=new Date();
hrs=today.getHours();
min=today.getMinutes();
sec=today.getSeconds();
clckh=""+((hrs>12)?hrs-12:hrs);
clckm=((min<10)?"0":"")+min;clcks=((sec<10)?"0":"")+sec;
clck=(hrs>=12)?"下午":"上午";
var stnr="";
var ns="0123456789";
var a="";

function getFullYear(d)
{
yr=d.getYear();if(yr<1000)
yr+=1900;return yr;}
document.write("<table>");

//下面各行分别是一种风格,把不需要的删掉即可
document.write("<TR><TD>风格一:</TD><TD>"+isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年");
document.write("<TR><TD>风格二:</TD><TD>"+clckh+":"+clckm+":"+clcks+""+clck+"</TD></TR>");
document.write("<TR><TD>风格三:</TD><TD>"+isnDays[today.getDay()]+","+isnMonths[today.getMonth()]+""+today.getDate()+"日,"+getFullYear(today)+"年 "+clckh+":"+clckm+":"+clcks+""+clck+"</TD></TR>");
document.write("<TR><TD>风格四:</TD><TD>"+(today.getMonth()+1)+"/"+today.getDate()+"/"+(getFullYear(today)+"").substring(2,4)+"</TD></TR>");
document.write("<TR><TD>风格五:</TD><TD>"+hrs+":"+clckm+":"+clcks+"</TD></TR>");
document.write("<TR><TD VALIGN=TOP>风格六:</TD><TD>"+today+"</TD></TR>");

document.write("</table>");
//-->
</SCRIPT>
18、显示停留的时间
  说明: 显示他人在页面停留的时间,而且可以作出提醒  
  代码: 
您在本站逗留了<input type="text" name="helpor_net" size="15" style="border: 0 ">
<SCRIPT language="javascript">
<!--
var sec=0;
var min=0;
var hou=0;
flag=0;
idt=window.setTimeout("www_helpor_net();",1000);
function www_helpor_net()
{
sec++;
if(sec==60){sec=0;min+=1;}
if(min==60){min=0;hou+=1;}
if((min>0)&&(flag==0))
{
window.alert("您刚刚来了1分钟!可别急着走开,还有好多好东东等着您呢!--站长");
flag=1;
}
helpor_net.value=hou+"小时"+min+"分"+sec+"秒";
idt=window.setTimeout("www_helpor_net();",1000);
}
//-->

</SCRIPT>
19、有影子的数字时钟
  说明: 这个时钟是有影子的,而且还在不停地走着呢  
  代码:
<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:'Arial black';color:#cccccc;font-size:20px;top:50px;left:173px"></div>
<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:'Arial black';color:#000000;font-size:20px;top:48px;left:170px"></div>
<div id="mainbody" style="position:absolute; visibility:visible">
</div>
<script language=javaScript>
<!--
function www_helpor_net() {
thistime= new Date()
var hours=thistime.getHours()
var minutes=thistime.getMinutes()
var seconds=thistime.getSeconds()
if (eval(hours) <10) {hours="0"+hours}
if (eval(minutes) < 10) {minutes="0"+minutes}
if (seconds < 10) {seconds="0"+seconds}
thistime = hours+":"+minutes+":"+seconds

if(document.all) {
bgclocknoshade.innerHTML=thistime
bgclockshade.innerHTML=thistime
}

if(document.layers) {
document.bgclockshade.document.write('<div id="bgclockshade" style="position:absolute;visibility:visible;font-family:Verdana;color:FFAAAAA;font-size:20px;top:10px;left:152px">'+thistime+'</div>')
document.bgclocknoshade.document.write('<div id="bgclocknoshade" style="position:absolute;visibility:visible;font-family:Verdana;color:DDDDDD;font-size:20px;top:8px;left:150px">'+thistime+'</div>')
document.close()
}
var timer=setTimeout("www_helpor_net()",200)
}
www_helpor_net();
//-->
</script>
20、全中文日期显示
  说明: 年月日都是用全中文显示 
  代码: 
<script language="JavaScript">
<!--
function number(index1){
var numberstring="一二三四五六七八九十";
if(index1 ==0) {document.write("十")}
if(index1 < 10){
document.write(numberstring.substring(0+(index1-1),index1))}
else if(index1 < 20 ){
document.write("十"+numberstring.substring(0+(index1-11),(index1-10)))}
else if(index1 < 30 ){
document.write("二十"+numberstring.substring(0+(index1-21),(index1-20)))}
else{
document.write("三十"+numberstring.substring(0+(index1-31),(index1-30)))}
}

var today1 = new Date()
var month = today1.getMonth()+1
var date = today1.getDate()
var day = today1.getDay()

document.write("公元二零零三年")
number(month)
document.write("月")
number(date)
document.write("日")
//-->
</script>
21、打字效果
  说明: 文字在状态栏上从左往右一个一个地显示,就象你打出的字一样  
  代码: <script language="JavaScript">
var msg = "欢迎光临,请多提意见。谢谢! " ;
var interval = 120
var spacelen = 120;
var space10=" ";
var seq=0;
function Helpor_net() {
len = msg.length;
window.status = msg.substring(0, seq+1);
seq++;
if ( seq >= len ) {
seq = 0;
window.status = '';
window.setTimeout("Helpor_net();", interval );
}
else
window.setTimeout("Helpor_net();", interval );
}
Helpor_net();
</script>
22、文字从左往右移动
  说明: 文字在状态栏上从右往左显示,而且是循环的  
  代码: 
<script>
<!--
function Helpor_net(seed)
{ var m1 = "欢迎来到网页特效世界,请多提意见。谢谢! !" ;
var m2 = "" ;
var msg=m1+m2;
var out = " ";
var c = 1;
var speed = 120;
if (seed > 100)
{ seed-=2;
var cmd="Helpor_net(" + seed + ")";
timerTwo=window.setTimeout(cmd,speed);}
else if (seed <= 100 && seed > 0)
{ for (c=0 ; c < seed ; c++)
{ out+=" ";}
out+=msg; seed-=2;
var cmd="Helpor_net(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,speed); }
else if (seed <= 0)
{ if (-seed < msg.length)
{
out+=msg.substring(-seed,msg.length);
seed-=2;
var cmd="Helpor_net(" + seed + ")";
window.status=out;
timerTwo=window.setTimeout(cmd,speed);}
else { window.status=" ";
timerTwo=window.setTimeout("Helpor_net(100)",speed);
}
}
}
Helpor_net(100);
-->
</script>
23、图像自动变化
  说明: 把一张图片变形扭曲成各种不同的长宽,非常好玩  
  代码: 
<img src="http://code.helpor.net/picture/swimming.gif" name="u" border="1" alt="很好玩的">
<script language="JavaScript">

var b = 1;
var c = true;

function www_helpor_net(){
if(document.all);

if(c == true) {
b++;
}
if(b==100) {
b--;
c = false
}

if(b==10) {
b++;
c = true;
}

if(c == false) {
b--;
}
u.width=150 + b;
u.height=125 - b;
setTimeout("www_helpor_net()",50);
}
www_helpor_net();
</script>
24、漫天飞雪
  说明: 漫天飞雪 
  代码: 
<SCRIPT LANGUAGE="JavaScript1.2">
<!--
var no = 12;
var speed = 10;
var heart = "http://code.helpor.net/picture/snow.gif";
var flag;
var ns4up = (document.layers) ? 1 : 0;
var ie4up = (document.all) ? 1 : 0;

var dx, xp, yp;
var am, stx, sty;
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();
amx = new Array();
amy = new Array();
stx = new Array();
sty = new Array();
flag = new Array();
for (i = 0; i < no; ++ i) {
dx[i] = 0; // set coordinate variables
xp[i] = Math.random()*(doc_width-30)+10;
yp[i] = Math.random()*doc_height;
amy[i] = 12+ Math.random()*20;
amx[i] = 10+ Math.random()*40;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
flag[i] = (Math.random()>0.5)?1:0;
if (ns4up) { // set layers
if (i == 0) {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(heart+ "\" border=\"0\"></layer>");
} else {
document.write("<layer name=\"dot"+ i +"\" left=\"15\" ");
document.write("top=\"15\" visibility=\"show\"><img src=\"");
document.write(heart+ "\" border=\"0\"></layer>");
}
} else
if (ie4up) {
if (i == 0) {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
document.write(heart+ "\" border=\"0\"></div>");
} else {
document.write("<div id=\"dot"+ i +"\" style=\"POSITION: ");
document.write("absolute; Z-INDEX: "+ i +"; VISIBILITY: ");
document.write("visible; TOP: 15px; LEFT: 15px;\"><img src=\"");
document.write(heart+ "\" border=\"0\"></div>");
}
}
}

function helpor_net() {
for (i = 0; i < no; ++ i) {
if (yp[i] > doc_height-50) {
xp[i] = 10+ Math.random()*(doc_width-amx[i]-30);
yp[i] = 0;
flag[i]=(Math.random()<0.5)?1:0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
doc_width = self.innerWidth;
doc_height = self.innerHeight;
}
if (flag[i])
dx[i] += stx[i];
else
dx[i] -= stx[i];
if (Math.abs(dx[i]) > Math.PI) {
yp[i]+=Math.abs(amy[i]*dx[i]);
xp[i]+=amx[i]*dx[i];
dx[i]=0;
flag[i]=!flag[i];
}
document.layers["dot"+i].top = yp[i] + amy[i]*(Math.abs(Math.sin(dx[i])+dx[i]));
document.layers["dot"+i].left = xp[i] + amx[i]*dx[i];

}
setTimeout("helpor_net()", speed);
}

function www_helpor_net() {
for (i = 0; i < no; ++ i) {
if (yp[i] > doc_height-50) {
xp[i] = 10+ Math.random()*(doc_width-amx[i]-30);
yp[i] = 0;
stx[i] = 0.02 + Math.random()/10;
sty[i] = 0.7 + Math.random();
flag[i]=(Math.random()<0.5)?1:0;
doc_width = document.body.clientWidth;
doc_height = document.body.clientHeight;
}
if (flag[i])
dx[i] += stx[i];
else
dx[i] -= stx[i];
if (Math.abs(dx[i]) > Math.PI) {
yp[i]+=Math.abs(amy[i]*dx[i]);
xp[i]+=amx[i]*dx[i];
dx[i]=0;
flag[i]=!flag[i];
}

document.all["dot"+i].style.pixelTop = yp[i] + amy[i]*(Math.abs(Math.sin(dx[i])+dx[i]));
document.all["dot"+i].style.pixelLeft = xp[i] + amx[i]*dx[i];
}
setTimeout("www_helpor_net()", speed);
}

if (ns4up) {
helpor_net();
} else if (ie4up) {
www_helpor_net();
}
//-->
</script>
25、图片渐渐显隐
  说明: 图片渐渐显隐 
  代码: <img src="http://code.helpor.net/picture/swimming.gif" name="u" border="1" style="filter:alpha(opacity=0)">
<script language="JavaScript">

var b = 1;
var c = true;

function helpor_net(){
if(document.all);

if(c == true) {
b++;
}
if(b==100) {
b--;
c = false
}

if(b==10) {
b++;
c = true;
}

if(c == false) {
b--;
}
u.filters.alpha.opacity=0 + b;
setTimeout("helpor_net()",50);
}
helpor_net();
</script>
26、图片渐渐显示
  说明: 图片渐渐显示 
  代码: 
<img src="http://code.helpor.net/picture/swimming.gif" border="1" id="helpor_net" style="visibility:hidden; FILTER:revealTrans(Duration=4.0, Transition=23);">
<SCRIPT FOR="window" EVENT="onLoad" LANGUAGE="vbscript">
helpor_net.filters.item(0).apply()
helpor_net.filters.item(0).transition = 12
helpor_net.Style.visibility = ""
helpor_net.filters(0).play(2.0)
</SCRIPT>
27、自由移动的图片 
  说明: 自由移动的图片 
  效果: 看到了吗? 
  代码: 
<div id="helpor_net" style="position:absolute; visibility:visible; left:0px; top:0px; z-index:-1">
<img src="http://code.helpor.net/picture/swimming.gif" border="0">
</div>
<SCRIPT LANGUAGE="JavaScript">
<!--
var isNS = ((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 4));
var _all = '';
var _style = '';
var wwidth, wheight;
var ydir = '++';
var xdir = '++';
var id1, id2, id3;
var x = 1;
var y = 1;
var x1, y1;
if(!isNS) {
_all='all.';
_style='.style';
}
function www_helpor_net() {
clearTimeout(id1);
clearTimeout(id2);
clearTimeout(id3);
if (isNS) {
wwidth = window.innerWidth - 55;
wheight = window.innerHeight - 50;
} else {
wwidth = document.body.clientWidth - 55;
wheight = document.body.clientHeight - 50;
}
id3 = setTimeout('randomdir()', 20000);
animate();
}
function randomdir() {
if (Math.floor(Math.random()*2)) {
(Math.floor(Math.random()*2)) ? xdir='--': xdir='++';
} else {
(Math.floor(Math.random()*2)) ? ydir='--': ydir='++';
}
id2 = setTimeout('randomdir()', 20000);
}
function animate() {
eval('x'+xdir);
eval('y'+ydir);
if (isNS) {
helpor_net.moveTo((x+pageXOffset),(y+pageYOffset))
} else {
helpor_net.pixelLeft = x+document.body.scrollLeft;
helpor_net.pixelTop = y+document.body.scrollTop;
}
if (isNS) {
if (helpor_net.top <= 5+pageYOffset) ydir = '++';
if (helpor_net.top >= wheight+pageYOffset) ydir = '--';
if (helpor_net.left >= wwidth+pageXOffset) xdir = '--';
if (helpor_net.left <= 5+pageXOffset) xdir = '++';
} else {
if (helpor_net.pixelTop <= 5+document.body.scrollTop) ydir = '++';
if (helpor_net.pixelTop >= wheight+document.body.scrollTop) ydir = '--';
if (helpor_net.pixelLeft >= wwidth+document.body.scrollLeft) xdir = '--';
if (helpor_net.pixelLeft <= 5+document.body.scrollLeft) xdir = '++';
}
id1 = setTimeout('animate()', 30);
}
var helpor_net=eval('document.'+_all+'helpor_net'+_style);
// -->
</script>


再把<body>改为: 
<body OnLoad="www_helpor_net()" OnResize="www_helpor_net()">
28、随鼠标触动而变化
  说明: 鼠标接触或者离开图片时,图片大小会相应变化  
  代码: 
<span id="s1" style = "width : 150"><a href="http://www.helpor.net" target="_blank" onmouseover="www_helpor_net.style.width='200';" onmouseout="www_helpor_net.style.width= '150';"><Img src="http://code.helpor.net/picture/swimming.gif" id="www_helpor_net"></a></span>
29、javascript的容错脚本
  说明: javascript的容错脚本,有了它,你的页面就不会出现错误提示了。  
  代码: 
<SCRIPT LANGUAGE="JavaScript">
<!--
function Helpor_net() {
return true;
}
window.onerror = Helpor_net();
// -->
</SCRIPT>
  评论这张
 
阅读(119)| 评论(0)
推荐 转载

历史上的今天

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2017