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

|
网页之跑马灯文字特效
//修改宽度) Y. Q* {2 b+ J5 K
var marqueewidth=300- p. q+ B9 p7 o- D: v
//高度
& A1 _' m# d6 ]2 C h v1 z" P& Mvar marqueeheight=258 \9 o* d& h% T3 S: m/ y/ V
//速度(1-10)+ P' M# o3 F# d( S
var marqueespeed=3
! c, \4 L0 O2 V- M3 v6 q, F//背景颜色: f+ G& h/ U; ~! ^ E
var marqueebgcolor="#FFFFFF"7 ~" Z" C4 z1 g6 B% a# K4 Z) u- R3 c5 E
//是否能暂停 (0=no. 1=yes)?6 n- U6 C a/ v2 {- d" [
var pauseit=1: f0 W9 a5 F; w2 _
+ S! y n3 i9 C* `+ J- [1 d//修改显示内容! B6 n* A: k) [, k# X
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'2 B: J: W% ]# l, L6 v
' A) J( P' a/ k& c( s* r* g f$ s
$ R8 Z& ]) I+ B2 o////下面不需改变////////////
, I! V: u+ C! c# ~# Y! @, t% P' W% d* c
var copyspeed=marqueespeed. B- m* D2 @( V; G8 K
var pausespeed=(pauseit==0)? copyspeed: 0" N6 K' t) I* S; C- s
var iedom=document.all||document.getElementById% h7 t8 y& e6 M# h5 E
if (iedom)
- Z* |- Z( L% Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')6 L- v1 m& X9 f; X
var actualwidth=''
! `0 F8 g& R: |, Jvar cross_marquee, ns_marquee
0 t/ Z. N, v3 Y% K
4 U9 G7 {; o& @$ k" e- Gfunction populate(){# ~$ B4 B6 k- }, W' X
if (iedom){8 }, n# T4 ~" C E' N! N) k$ U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 Q" h4 n1 |- _7 f
cross_marquee.style.left=marqueewidth+8: A {; m9 u$ Q' z# b
cross_marquee.innerHTML=marqueecontent
6 G4 G9 ?. q! c4 U8 Q8 Uactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
$ V8 j/ q( r9 K4 d8 _! G}7 Z+ e( j' d! F( L
else if (document.layers){
$ u$ u' ?$ M* a) w; m0 H9 Xns_marquee=document.ns_marquee.document.ns_marquee2
1 U# k `& \( Q- E" Hns_marquee.left=marqueewidth+8
0 F2 K) x. w% s" q: Ans_marquee.document.write(marqueecontent)& m$ Q( ~$ d2 f% I. @2 y4 w2 m6 y1 a
ns_marquee.document.close()
8 W+ H# c( N( i* l4 Kactualwidth=ns_marquee.document.width
& t# R' W! X& N' e( j& o* k" Z}0 ^. n) B! E* b, @2 C1 X; A, x
lefttime=setInterval("scrollmarquee()",20)
. B6 F# W; J9 O! X}3 }' ]0 Z6 @$ F( O1 g# n. N& u5 Z8 j
window.onload=populate
! I( v! b- M4 e. K: u& h9 W* d- \' W, x, f# H7 l9 Z' A; @
function scrollmarquee(){
- W+ y. H4 s2 f: Mif (iedom){/ l8 r5 q. I* J7 H) f9 W$ I W
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))' L! t6 u$ P/ K, Z
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed% f. U( p+ @& }0 E2 i" A3 d
else. m# m/ m! x# M) X
cross_marquee.style.left=marqueewidth+8
6 N, T. J9 R1 V+ w% S1 l$ F5 f9 ~4 @0 v* p9 x, e( }
} w- `: U! }: \ f
else if (document.layers){
% T( o n% J- U/ zif (ns_marquee.left>(actualwidth*(-1)+8))
7 Y8 @: c" O9 G" Yns_marquee.left-=copyspeed/ t6 k5 m b6 p# E) C$ ]
else! h+ D& y! h5 D0 U, |, {
ns_marquee.left=marqueewidth+8; e( @* F1 @7 k$ a* h& D
}; d, p! W r& Z) R1 |. q
}
; a/ Z% p- J! {4 t( r' Z5 [
4 [3 z8 R5 Q$ v Z8 vif (iedom||document.layers){
P, C7 J1 R9 t4 S0 F* I Ewith (document){8 q$ ?' C3 ?$ x% d2 ]/ B0 }
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
! J* o- r( s: C# Wif (iedom){+ [) G% q% O/ A0 b
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
, }) |2 J1 c/ }7 P; w0 K0 @write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
8 G- P9 G- Y$ l/ O% wwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
9 Z3 `6 [$ t5 y }- Z3 N3 qwrite('</div>')
/ a, D: L' Z) M" Q}
: Q, N- P$ c i- U) w/ K- ^5 c: y' }else if (document.layers){8 x( B1 V/ Q) B& f; k' U8 p
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')- J2 K& j W8 n/ |6 t* X
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>') N( P+ K) @& @; X) o& ?
write('</ilayer>')
( B6 S0 m$ _) I}
; P+ L9 `/ c; j+ L0 Kdocument.write('</td></table>'), |9 l# K; S; U% K0 `, @9 X+ k- Y
}( [* k6 m6 m/ S8 e6 p; _
}. q' j% d$ z, ~3 y. B
</script> |
|