Board logo

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

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

//修改宽度
' R5 w( f% j) D$ kvar marqueewidth=300. Z6 d& i) n( s# Y0 u; b( d  ^
//高度
* \* h/ `' B. \var marqueeheight=253 ~1 w& j. V" F, R3 k5 K
//速度(1-10)
$ `1 l; C9 F: |8 Y9 uvar marqueespeed=30 x' i4 i: C) k* [
//背景颜色. ?( \% U& z/ G$ ?, ~+ [9 F4 ~4 }
var marqueebgcolor="#FFFFFF". D1 U  M' }7 O$ J- @: i
//是否能暂停 (0=no. 1=yes)?1 X, o3 Q$ E1 ?8 F
var pauseit=1
# V6 M- |; Z: L+ z; K
+ V0 |; _6 F. g//修改显示内容
/ C6 X4 r6 l1 ]+ z  b& dvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: U, g' r& g' s! D
7 r! r+ a' }6 J2 ?5 A* N& p' @% h$ Y, k, G
////下面不需改变////////////
5 ?: z! L+ t, b7 s# \- k! G% Y- }6 l% [* W5 [! O
var copyspeed=marqueespeed2 k' l/ e2 f$ i3 E8 c0 U
var pausespeed=(pauseit==0)? copyspeed: 0" b; D/ U9 w7 m$ E
var iedom=document.all||document.getElementById
, E4 }! C  l  ]; j, W: Z% Yif (iedom)" M& N  Q3 n- i7 S& U+ p& R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')2 r' M* j7 ~% b" k2 s" Y5 {
var actualwidth=''; U4 I0 |  q2 W0 T( d+ a3 `% m
var cross_marquee, ns_marquee" Q0 Z8 l. B7 O4 E+ G% q
2 j% e) r& x) d, k0 q4 W8 N1 g/ Z
function populate(){
8 j0 Q( d* p% y& E9 Mif (iedom){
9 G8 @7 m- `2 _5 z& W2 Wcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee* g& v- u4 k' Z; T  Q+ T8 g/ f
cross_marquee.style.left=marqueewidth+8
: N* c' z1 j( V7 M6 _3 Vcross_marquee.innerHTML=marqueecontent2 p+ j. X! ^% r7 T4 j
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth) D0 f. g9 ]! f% t4 S& f3 L; r1 n: O1 U
}$ ~. {: D! W& U' B: z& x
else if (document.layers){
/ h' T, E; |. E# T7 a3 U- fns_marquee=document.ns_marquee.document.ns_marquee28 _/ b8 S0 m& D3 G
ns_marquee.left=marqueewidth+8
3 E* O. o  O3 ^6 q) ~5 tns_marquee.document.write(marqueecontent)  _3 {  g9 N: E! z( X! b
ns_marquee.document.close()9 i# f( n, c* m0 O3 x2 y  Z
actualwidth=ns_marquee.document.width
; }! b  v9 I% H' Q* e* m0 O# a}, |, \& v3 I4 V  Y+ J
lefttime=setInterval("scrollmarquee()",20)5 t1 I. b5 y2 X2 f5 I" T
}
( U% F( n, y# w# c6 F: a' ewindow.onload=populate
$ k% A: J  n9 H& g7 A1 d
/ F1 b0 m$ ^; F' |- Ifunction scrollmarquee(){
. a! t0 a9 b! g7 Rif (iedom){) G0 d& x: W* R6 n
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 D2 X# c" F) w! G: B0 Gcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed+ `4 i  {, w( g* A+ ~: d
else
5 |" |7 }1 g! t5 E2 ?4 f% icross_marquee.style.left=marqueewidth+8
" ~) ~0 n8 @, D' u% d: g9 b
- E/ k# C# R7 D7 L0 ]7 v}& `3 `, k+ v& f, e- s5 w
else if (document.layers){- ~; O* P, t/ W" H/ u3 X* j, S
if (ns_marquee.left>(actualwidth*(-1)+8))
8 F7 @" _' y2 c3 {% g0 a( o# [ns_marquee.left-=copyspeed
% M& D% `2 a+ n0 ?8 Y8 d( belse
1 [0 s0 {5 d/ _, o) D  N! Ins_marquee.left=marqueewidth+8. S- V: i3 }9 B8 a
}
2 H) N4 i( ^  }9 g5 n, V$ ?}
; s& {  L; o4 q; Z3 k" e8 j7 c: Z3 W
/ ~) \3 K' F- x& q- S$ Y# m2 Fif (iedom||document.layers){$ K) L) [* `  n  B& S8 b3 f
with (document){* a: k$ j3 _! C7 V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% D' C6 E4 L# Q+ |8 x
if (iedom){) H$ _! t2 ]  f8 G! D& r
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
2 v; Q8 D5 ?8 Y; V) j$ Q# Zwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
6 w& T+ f( A' @3 [1 ~3 bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'), O+ p, ^2 |/ R
write('</div>'). c( a/ N- k, u
}7 Z7 h% ^  W4 H3 B( K
else if (document.layers){
. A) q5 ~4 q- [' E/ Z; lwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- y3 y7 a1 h4 l$ B9 F. E# s
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
; B; k! k9 _/ c$ J4 ~' }6 W& iwrite('</ilayer>'). f! S* m& Y4 v% s2 |  U. u
}
5 n7 {4 `1 D6 [/ k6 O6 xdocument.write('</td></table>')
2 l! X3 Y: M: M% J2 c4 Q}
3 i! ?) S# B4 P: i9 N}
- z: w5 [. u2 N/ ]</script>




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