Board logo

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

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

//修改宽度
8 G- _4 e, l/ K# e2 _var marqueewidth=300
9 n: ?) k& j/ c0 B//高度# k/ X, r# c/ S$ l5 `
var marqueeheight=252 Z3 ^0 d+ s" x6 h9 O3 A. ?
//速度(1-10), N/ b0 l. g  q' g: X; \
var marqueespeed=3
; Z( S( y( A, I4 B+ M//背景颜色* A+ ]: Y3 Y+ g' Q; A4 A2 r$ T
var marqueebgcolor="#FFFFFF"7 _  V/ L% W4 i  Z: f
//是否能暂停 (0=no. 1=yes)?
) y4 k3 _( k9 m# N! `var pauseit=1
3 C0 r! u- |+ t8 Q( G
2 |. q+ |. X( }6 P; _) R//修改显示内容/ {  w$ T9 S5 s/ `0 G8 }
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
7 I1 F# z& Z1 t! ~6 Z; b
7 U8 E& P* H4 F- g: M
% q( k; g0 G/ n4 ?9 s////下面不需改变////////////
0 P* _! F& V9 `
5 x5 d  x9 I( _+ j- D& N4 w% B# b' ovar copyspeed=marqueespeed# z2 H; y$ l4 `0 t+ }& N7 ~$ |
var pausespeed=(pauseit==0)? copyspeed: 0
5 d" o. Y/ r% v# @$ i) Jvar iedom=document.all||document.getElementById: f$ t/ U& R2 p* X. ^
if (iedom)+ z' h, b1 b# e: A! {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')  p) o" q+ d6 m4 L8 L4 Z6 {" y
var actualwidth=''8 t; P7 v$ l1 d. b' g. G
var cross_marquee, ns_marquee
' ?2 u$ E" l1 t7 d  ]) p7 M( S# R: f( s, `, i& S8 Z
function populate(){
+ M3 [# @& @  {if (iedom){' W  v9 S+ o0 Y+ z
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee$ M; z8 c) N, G) I! D/ S/ f2 Q
cross_marquee.style.left=marqueewidth+86 G) ]" T! R$ ~: h/ R
cross_marquee.innerHTML=marqueecontent* v+ h3 R7 U: |/ ^
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
6 R% `+ N) }! S/ P7 X6 E& }}
' {! @. u  K. H; o* L/ }& velse if (document.layers){
7 [9 D' i& P. r" Xns_marquee=document.ns_marquee.document.ns_marquee23 [* x4 V' f" |! ~6 _2 M
ns_marquee.left=marqueewidth+8
( D& t  ?6 _/ d" _7 n" {* Fns_marquee.document.write(marqueecontent)
! O# ?2 W; |& T9 X5 \& `ns_marquee.document.close()
0 e2 E6 I) a, B. A! e6 E3 Zactualwidth=ns_marquee.document.width% O/ @+ A  h  m0 r1 C% Q0 T
}
5 e  r; W' c( i% R; _0 ~; ylefttime=setInterval("scrollmarquee()",20)% E3 D0 `- N7 y) E5 m
}) p; [9 h4 E6 C
window.onload=populate
/ b7 p$ L9 f5 o  k- `
! Y) d) O: U  g/ L! bfunction scrollmarquee(){
0 P6 j' k/ f) q1 e; |if (iedom){
+ }5 ~0 Y# M: S7 b4 _3 p) ~if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
5 B  }. n3 F. O& ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 p9 P5 A$ }, n9 C' [
else' ~$ B- D; u; R2 a3 T0 F# X1 e
cross_marquee.style.left=marqueewidth+8
+ l& ]) U8 s, u: g, B* @% P% F4 ^( n. e3 c0 \9 [) V' Q1 w3 p6 x
}, k# b: H, q2 I4 q( G! a! B8 @9 |: o
else if (document.layers){
" h7 ]- i% E( |0 E+ p* {4 p/ `, _if (ns_marquee.left>(actualwidth*(-1)+8))
. B8 E' e* w. e' v0 ^ns_marquee.left-=copyspeed
3 F$ O* X0 b; k( l6 v& ~else
+ F, q' ?$ {3 ~ns_marquee.left=marqueewidth+8
/ ^& R8 |! E6 r$ t9 n( q9 L}+ O& r5 R: D1 t) J# N+ Q9 j
}
' k0 i& h+ @0 G$ q5 r2 T% [
6 D& ?6 W* W# q, {7 W) dif (iedom||document.layers){
- r% q; Q( o5 {2 \8 @  @with (document){2 e1 s4 B% Z' E' K
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 v$ z# m* K+ b2 J' o* I% y" M6 ^
if (iedom){% f  m4 p& \4 U" ?: D4 `
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
- Y! o, I) M- z. ^4 Swrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
+ H: \  S# |! k) gwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')' ]' [7 A) O7 |; h: _
write('</div>')
# V) P2 X$ K: t8 s}
0 Q9 B0 L( @6 r; o) E* v: ~else if (document.layers){
# l$ n! l0 A3 m7 t* G4 y. qwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% _' M; ~- x. twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')& c4 w4 E' O& j. D* s  G. J
write('</ilayer>')+ @. i4 _8 E( |
}" @& }( b' b$ J1 E2 X1 f
document.write('</td></table>')
; i; d- J. N, g3 ]}
; w, U+ q: g! m. Z}- ?& a7 c* n2 i: x$ T
</script>




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