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

|
网页之跑马灯文字特效
//修改宽度( s* Q2 g/ V% w8 t$ l, v
var marqueewidth=300
- q! J4 h/ h. I/ D% E//高度
7 k* p/ }+ M5 H' d7 p, s3 H8 jvar marqueeheight=25
3 y d8 y5 S& m% y1 |//速度(1-10)/ _7 ?2 l( M2 x. s8 ]8 T
var marqueespeed=3
5 O* d Q+ u: }- R" p//背景颜色. G' [- n4 @2 G+ X( ^- `
var marqueebgcolor="#FFFFFF"5 U" x( Y8 W3 G4 j0 c1 O+ Y0 Q
//是否能暂停 (0=no. 1=yes)?
, ]% R; H: O F$ [$ H dvar pauseit=1% m2 w1 _7 Z% m+ k* k
# X. X) k( p8 G( f" d' R* b' O7 f8 m
//修改显示内容: Q/ a/ b. K1 w' J' v2 F
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>') i$ j, n. ^( m, j; S
7 y2 W7 T9 R, A, L. I% W& Q3 _! g! Y/ Y2 F7 F7 H3 [
////下面不需改变///////////// r6 ?" q. C- V$ j) W6 x
: a) U4 m, u6 c7 j% G" p; S. evar copyspeed=marqueespeed
# M6 b* P. K6 o: ^var pausespeed=(pauseit==0)? copyspeed: 0 C2 P" ~8 h7 x1 e& p
var iedom=document.all||document.getElementById" \6 A( F0 k6 a; S) W
if (iedom)
6 a/ q+ o9 S/ V: B( V8 |, H' Vdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')0 i$ N1 x6 }5 [. O
var actualwidth=''
( Y: I& R7 w; v6 r$ v. cvar cross_marquee, ns_marquee3 ~/ i3 r- [) f
, y: h5 s+ @0 C. Z. h& tfunction populate(){
6 |$ z' P8 Q0 ^if (iedom){
. Z/ ^5 _1 C: z- M3 `4 S2 ocross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 {9 X+ Z# m0 ~cross_marquee.style.left=marqueewidth+8
2 P: F! V, G) A2 ]cross_marquee.innerHTML=marqueecontent
0 L8 s- @& v- H+ Kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- q3 [8 b6 a- q
}
6 x- v; S* x) i: Melse if (document.layers){, t% x1 Z$ _# ~- p2 Y: G9 b
ns_marquee=document.ns_marquee.document.ns_marquee2
0 e+ w. ~; x6 ~+ G) `1 |/ dns_marquee.left=marqueewidth+8. S. d/ n8 U# T
ns_marquee.document.write(marqueecontent)$ j- O& O( P4 V* o9 J8 S
ns_marquee.document.close()
. }, R! n8 d2 ~+ yactualwidth=ns_marquee.document.width
' ]$ D0 l2 [9 t+ H; K0 v/ `+ E}
9 A4 B( }$ j$ K. }! v9 I- hlefttime=setInterval("scrollmarquee()",20)
" k3 o4 q* W4 \, Q& R* F/ C# A}6 x4 H* L! ]& W0 ]+ F' U
window.onload=populate
+ `1 ?' D; i1 X" U7 f
0 e6 e8 N6 s0 J8 Q$ N) pfunction scrollmarquee(){7 v+ S' r6 j: p: K5 k e1 C
if (iedom){
d Y0 n# ^2 S1 Qif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))! W( t i1 I: l0 n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 U& K3 r, Q. f9 s( |) `
else. R% G0 s- K) H
cross_marquee.style.left=marqueewidth+8
/ E. Z" a2 u7 d6 W7 W1 Y
# y" H# k5 @. j7 z" L2 w* M}+ @' q5 e" r! |& a1 ~5 c( c
else if (document.layers){
, b8 b. z a4 O* {# J: e9 o" H8 gif (ns_marquee.left>(actualwidth*(-1)+8))
2 p+ t. J" L4 y ^/ ?/ g a( n2 lns_marquee.left-=copyspeed
/ n! n9 M/ C$ q4 X$ ]* k6 z8 n, A4 Uelse
( R8 I- g; g! e4 p5 {ns_marquee.left=marqueewidth+8
$ O3 q/ d' f Z$ e5 e+ C+ [}0 k, Z! M4 M }4 L+ `0 f, Q! ?3 u
}
5 ~! X) ^- c, h5 I3 t5 Z8 S7 l' S5 y( A" z* T3 ]7 k( M! h
if (iedom||document.layers){: I+ M9 ^ ~7 Y0 l' I5 x i
with (document){
7 J z- ~1 c9 f5 Fdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
( f" ~& `% x/ Y/ xif (iedom){+ @7 n5 t2 T' w5 M1 L/ g
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
5 @/ y- a$ @5 q( k0 T; D2 d8 Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')* c0 y/ @% }+ _ q! r
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')8 W& g! y, {* A* N% {
write('</div>')
; u/ r; E! v! i2 e, e! y# E# f}9 z: H7 x' t6 ~; ]2 u- {) Y6 J
else if (document.layers){
4 @4 d, U. K. D" _3 k, s9 ~2 _ Twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) {) f( p, F- r3 R9 ~write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# B' W' k8 K: N7 K7 H$ z+ u
write('</ilayer>')
. x% |5 z4 a9 Z9 V( a}
+ y; l: F# b3 bdocument.write('</td></table>')$ i' ]! Y9 K& l- V; ^
}
& E1 A, x& H& k2 n: w}5 Q5 O: h& X. H' N+ T9 U% H2 l
</script> |
|