Board logo

标题: 网页之跑马灯文字特效 [打印本页]

作者: zw2004    时间: 2008-1-21 20:53     标题: 网页之跑马灯文字特效

//修改宽度
" E6 s4 `0 v! Rvar marqueewidth=300$ t; R: D: v# B2 z# ], J
//高度+ E7 Z, V  g2 `/ y  u- c8 O- \
var marqueeheight=25
1 H- t+ e/ M' z  r7 I& g& Q  R( n//速度(1-10)
! f* Y, T/ ~! x) {! fvar marqueespeed=37 @7 l8 X  l9 A5 S5 \
//背景颜色/ A4 O# d; C2 e8 f
var marqueebgcolor="#FFFFFF"
6 z' k1 [& @' S9 z9 F( V% S4 a9 S//是否能暂停 (0=no. 1=yes)?, E5 M& [7 ]2 Z3 k9 g# q# [
var pauseit=1
* t5 S4 M' u" v0 T& Q" L/ r, @6 V7 {8 y8 `8 G; p' {% J
//修改显示内容
% K9 @9 i- m* I$ K0 B- C/ `var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
' j. w7 x: ?% i  P
, I/ h9 ~, X" w2 @
" D7 D, ^! X# _( F////下面不需改变////////////- _( J. D. J7 z: z* t$ A

  G, r( W9 b( W' u1 u' A' tvar copyspeed=marqueespeed% B% l% n, C) R( |
var pausespeed=(pauseit==0)? copyspeed: 04 m" }* s% _" o3 n3 d4 e( t( w: W# n! P
var iedom=document.all||document.getElementById% ~/ ?& |( @3 C$ K$ A; c
if (iedom)7 {5 u% L: f) Z* Z
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')" s" B. h" h' H$ k" _
var actualwidth=''. G4 j; T- y. s( M5 {, _. e6 d
var cross_marquee, ns_marquee$ U8 k& N$ K" n7 c  m; ~/ c$ O

2 A, p' T+ }+ z) pfunction populate(){0 c, C4 j! K7 t- H# e# t6 \2 Q' r
if (iedom){
3 o" Q) [+ V9 mcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
) p  a; O& q; `* xcross_marquee.style.left=marqueewidth+8/ ~4 v/ E0 }3 y" n- l# ]' Z8 A2 c
cross_marquee.innerHTML=marqueecontent! N) h8 `. f% Z1 D/ Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, W8 f* Y4 V# _$ x; W3 K}$ a! i  x6 X, o3 ]
else if (document.layers){
! R' }; ?9 b  ^7 C1 u; g4 j, J; @ns_marquee=document.ns_marquee.document.ns_marquee2" e! d5 C. W: s1 |
ns_marquee.left=marqueewidth+8
7 h% D5 Z0 C: i  v0 cns_marquee.document.write(marqueecontent)
3 {6 h; D0 f0 v8 V# Q' ons_marquee.document.close()
- j; m( p* `* C* r. B' v/ mactualwidth=ns_marquee.document.width
7 s% X$ X# j) P}
* P3 n8 ]% _7 Q, _5 ulefttime=setInterval("scrollmarquee()",20)
; j% [( m8 J9 }1 x}  Q! P# _5 i2 M4 F
window.onload=populate; J; s) u% e# n3 f1 x

* M7 a8 S0 \# Yfunction scrollmarquee(){3 D+ K$ ~8 |: A& J: F1 @& s
if (iedom){' L3 Q- H5 v$ O$ w
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)). _# s. ?, {1 b& N4 y& R, u
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
. f1 G& L, s3 y& {. Y7 K6 j: T+ Ielse+ C) _2 L- U4 }# x; O. S$ J  X) R* H
cross_marquee.style.left=marqueewidth+8
4 d  b, e- Y; E% k
2 L, w! y4 s6 d$ w}$ s& o; s& Q1 d) g
else if (document.layers){5 o1 G0 e( R* [# z, M4 c# P" [
if (ns_marquee.left>(actualwidth*(-1)+8))& a9 ?8 T. [# |7 \# K: ~
ns_marquee.left-=copyspeed
4 x/ Z' ^' Y7 belse& g0 [; F# k; I8 Y
ns_marquee.left=marqueewidth+85 N( K+ T7 A" C
}' z7 G" C+ v+ G7 r' c  V# k; V
}$ }0 }8 ^5 h& A5 {5 i# Q
9 `* m/ b9 J( O4 B
if (iedom||document.layers){
' J5 O$ A0 H* Q$ N) l- Owith (document){
% p) i% Z. O2 g4 _3 Udocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')5 E. l8 P) Q+ z& l2 ?; D
if (iedom){
& x) z! K4 A' r, q3 U  @4 e3 I/ bwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
3 F& C# i) D  O1 u" Bwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')6 N  y9 ?! E+ Y( I" ]8 n  ]
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
8 @/ B9 {9 d" Swrite('</div>')
# Q* r! r1 g, @* N+ x}6 z' z6 o! c1 K8 _7 h
else if (document.layers){; r' a. ~' P' s2 W! h% ^
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
) l1 W  W& Z+ J2 y' Kwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, q: B3 j# f$ o4 [8 [write('</ilayer>')
( r# N8 b; G& H7 Z% L1 W, I}6 {: R; c7 q) |4 L2 C
document.write('</td></table>')! K/ r5 _, {, m- Z1 i- Y
}/ ^% W# A# ?) v: J- s# i
}3 O; E. C# ^, j* P6 v8 K) w
</script>




欢迎光临 捌玖网络工作室 (http://89w.org/) Powered by Discuz! 7.2