|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度
. i! a) b) d: q+ b: _var marqueewidth=3006 p- C$ G8 H3 _" c
//高度. F, |4 |" w: J- v: u0 b
var marqueeheight=25' @8 ~! F! G- ]# n
//速度(1-10)$ w- Z$ `' H: \- H! C; L+ A! F% r
var marqueespeed=3. S4 W- q! S8 G2 \9 i1 p
//背景颜色 e% p; D' p* j/ {- a, M3 H+ d
var marqueebgcolor="#FFFFFF"
1 g7 [9 C6 m( A6 T/ V//是否能暂停 (0=no. 1=yes)?
! K+ y8 F- n- E3 z( Yvar pauseit=13 M! Q8 {0 f% b
& x1 y) |) e+ {% [ M//修改显示内容, u$ J# F) O v2 R" E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
. Q; ~4 g( d; b8 J k' @
* }7 X! U. k) p7 X5 `
6 t7 B q. H- E////下面不需改变////////////
: w' n8 E" M/ p9 t
( K2 @2 F2 V r' W' H2 t' k$ v' Wvar copyspeed=marqueespeed
; a% E) g! K6 H" j3 ?var pausespeed=(pauseit==0)? copyspeed: 0
3 q8 I+ B |0 o* X! _+ wvar iedom=document.all||document.getElementById
7 a2 K2 x" g; X7 Uif (iedom), I0 M8 M; V+ }% f# a4 x2 C
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
8 C% q9 U3 ]! R6 Q9 x% E5 C1 U+ `0 Yvar actualwidth=''
" v2 A3 W3 J3 Z" x7 t2 qvar cross_marquee, ns_marquee
: @- X7 [/ W2 P3 s2 x) \
" a8 x$ i$ c N$ F8 n' Ofunction populate(){) t* P v5 b8 Q! B+ s
if (iedom){
8 J( c7 ]! I0 F9 ?cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee" x: j! @ c# D/ c# x
cross_marquee.style.left=marqueewidth+8
( n# I0 H1 P6 V, _) o- Ncross_marquee.innerHTML=marqueecontent2 n# P s+ V" _
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
8 o+ E3 |2 m5 r+ x F+ s3 m8 j$ q}8 y# {1 P) g0 Y, V7 w9 d
else if (document.layers){
" z, T8 J m# I2 ~) Qns_marquee=document.ns_marquee.document.ns_marquee2! O! O! o1 @; n3 H
ns_marquee.left=marqueewidth+8- ~( i" F6 A/ ]# w
ns_marquee.document.write(marqueecontent)
1 S& m" G2 Q7 c Mns_marquee.document.close()+ k7 n) W% ^% z2 {( e
actualwidth=ns_marquee.document.width1 p9 t5 z" w+ {, y
} i) o* e/ @7 H: f. r ?8 I
lefttime=setInterval("scrollmarquee()",20)2 k; H0 F7 T8 t9 m. t
}% c9 q% F- n$ z0 U( ]+ {
window.onload=populate
; Z5 B7 V5 A! v% R. F% V7 E3 M& M: n+ G# r8 C! } v- z
function scrollmarquee(){7 M. s; a7 y0 T4 ]: `" @! H
if (iedom){7 {5 f! ]" O" \* f8 b) m2 L
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
0 F# e/ C; W% F1 Zcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
& N' S3 ^) C5 nelse
" _4 w, U$ Q5 {/ V; g% y5 C# R* ~4 Rcross_marquee.style.left=marqueewidth+8
% X# C. h+ k! _% a. e6 W4 [6 L! q5 Q5 v- `, z) i% D
}" {' M( F# M7 l! e; [
else if (document.layers){* h) [; _' V$ l) T" A
if (ns_marquee.left>(actualwidth*(-1)+8))* o. \) n6 \$ k2 @0 @/ w3 t2 Z2 e
ns_marquee.left-=copyspeed
- U+ [3 A) _/ {3 h5 O2 Eelse
/ e) \% {1 H! M0 h/ M/ ens_marquee.left=marqueewidth+8
' k# Y% L+ N& {- O8 [4 y}4 p- L, `& V' @# z5 R% g
}4 U& B* n; m/ c0 J8 L6 e" w1 e
- p" S& _2 V( @
if (iedom||document.layers){
7 Z& N/ S l2 \3 V& Wwith (document){4 { p3 `, {* M9 Q3 O
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
2 n7 j" M2 g! Z! a2 S! ^if (iedom){
5 N7 C1 v, L6 e! n* U( Uwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
$ i# }/ q4 z" ^; O( i6 |+ |write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
! n4 V1 n' U% Y$ B6 Cwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')% \* K. T, r# t2 G. ?2 Y5 \
write('</div>')
' ?2 ^' U0 I; S# _" _" y6 |" _}5 r1 C* _/ C1 _4 S6 H6 O1 m; m- |
else if (document.layers){, E: L! y/ R: p6 y1 u$ f
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')" W- ?" _ X$ N5 q8 @
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')! N2 Y. f4 U; ^8 z2 O3 c5 G
write('</ilayer>')! m. U' W, ^; M) j- g
}% W; k: x& c L( d! B5 x! F
document.write('</td></table>'). t/ f0 J2 l) j2 m" G8 r y
}4 G% M7 d: ], f. W' ?0 g$ Y Y. X
}$ }4 M0 Z, l8 O; f8 t
</script> |
|