返回列表 发帖

网页之跑马灯文字特效

//修改宽度
6 M9 k  \" @( s" Dvar marqueewidth=300
5 d% l& }* N, @1 o3 \* C//高度2 i$ b2 L& o9 v+ ^7 S- Z. W
var marqueeheight=255 \( h+ D. D- S& |3 q
//速度(1-10)
+ m( c/ ?* o7 W4 `% D6 evar marqueespeed=3
! |- _! m9 H1 H9 p5 P% {) Z//背景颜色
' l# T% [9 x3 x8 p1 svar marqueebgcolor="#FFFFFF"
/ N+ b: r0 @! i8 [//是否能暂停 (0=no. 1=yes)?, `" |8 s0 P* Y( ?+ L
var pauseit=1
% {0 C! [3 l" q& N1 x' {
! a: p& F+ }& f. |4 R//修改显示内容/ {1 p, G! O4 g9 O- t) A
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'1 T1 ]- e* u: ^2 {' `8 `
/ l: B; K6 E- x% d- F
! m0 }5 u- ]0 a( o# l
////下面不需改变////////////
8 X# j8 g# X+ B# T% J
2 R6 O+ Z+ T1 Z% i- uvar copyspeed=marqueespeed
" F& T! @, N! Z/ Q1 o  m) ~! J" Xvar pausespeed=(pauseit==0)? copyspeed: 05 |2 n" @6 {. F' }
var iedom=document.all||document.getElementById/ X; D& [3 m7 b( A8 H$ ?2 S
if (iedom)
5 U; v" H7 k& G8 F" i' [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
3 u- j" f8 G9 H) W9 S0 [3 Rvar actualwidth=''
! b" i5 h' f0 U# jvar cross_marquee, ns_marquee
( M1 f: `" n1 C; M6 z. w1 L  X  C+ o8 j" r
function populate(){* A2 W! E1 ~6 N1 f
if (iedom){
5 [9 Y& H" y+ B6 B  i: qcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 @9 ^. ^# j$ x! O9 w: P3 ^' I. @5 V
cross_marquee.style.left=marqueewidth+8
2 W8 E% y$ U5 D7 Wcross_marquee.innerHTML=marqueecontent
2 q! A% h& m5 n4 }# u1 l% Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
& Q  Y4 W! q) P5 V  [& R. m}
- s* `2 ]  v1 yelse if (document.layers){* d. o7 }$ t. q8 f
ns_marquee=document.ns_marquee.document.ns_marquee2
3 G. s3 Z4 e  y, L% w; |ns_marquee.left=marqueewidth+83 d/ b6 G/ \! ]
ns_marquee.document.write(marqueecontent)
3 j  ]0 f/ r$ R! a9 ^ns_marquee.document.close()
6 T1 ?' H+ `5 T; C! q/ B  Eactualwidth=ns_marquee.document.width
; E# `2 ?" X1 R% I. j}: L3 u$ X+ {7 A* s
lefttime=setInterval("scrollmarquee()",20); ~' G. s+ a4 k' K/ v& o7 ^6 c
}9 Z, e4 X! o  n; e' ]
window.onload=populate
9 L+ X* K; p- d: r3 [3 R+ T' v1 t5 A. [
function scrollmarquee(){
; B4 v' ^* C0 t3 qif (iedom){
3 o& L+ l; T- yif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))/ m' ]/ p% ?9 O4 ?6 I$ \
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
* ?/ r+ H( e& \# Z0 celse$ {! E" G+ S$ p. c2 q% z0 j* x
cross_marquee.style.left=marqueewidth+8/ z, b# V+ L# s( @% j

+ ~  \: X0 M. L4 g7 T3 W}
& X8 ]$ S6 d7 F4 a* h, ?2 |+ s4 Ielse if (document.layers){
0 W) q  O; @9 |* r2 W% n$ Tif (ns_marquee.left>(actualwidth*(-1)+8))0 ^9 t& v9 X. n) V$ z! k, ^" N
ns_marquee.left-=copyspeed) b; X5 ]3 {+ S$ G/ x# t- R
else  ~" v" B  u, k. ^. p8 R5 g. k' H5 @
ns_marquee.left=marqueewidth+8* p3 ?1 N# ]7 K; I0 {
}
* }  g: |% _; X5 k}% n$ L" M5 X2 V$ d

$ f6 \4 t9 q1 R8 a$ w! @if (iedom||document.layers){  U9 V9 O+ y& L0 ^
with (document){
+ x8 ~3 N, S( adocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), c; {$ I) }2 A0 I- m& n! ^! t
if (iedom){
: p- S- T* `1 c) r  e: E  ~2 Rwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')7 k, S5 b$ i- ^2 y3 n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 m% K$ x+ Z" Q0 g" O
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')7 @5 o" K, W# T& O  b  ~8 ]
write('</div>'). t1 D/ Y' @5 a, T2 O# Q
}4 B+ G& B0 E+ w+ k
else if (document.layers){+ x3 I8 p8 s8 k7 X) W* X* R4 m
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')* x% \' N9 U0 @$ r
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')* ]; C& O# y. Y
write('</ilayer>'). N  [# I4 A) G! m
}6 {( ^0 q# K5 k/ ]4 D0 N0 O
document.write('</td></table>')
/ }0 s: n" a( U. J- M) O}
! @6 O9 T* ]8 M6 Y}
" y& a& f2 F3 `: @) W</script>

返回列表
【捌玖网络】已经运行: