返回列表 发帖

网页之跑马灯文字特效

//修改宽度
4 [5 ~4 S& Q) R5 Q, x* h! M6 Mvar marqueewidth=300; p7 c1 {2 E3 B
//高度* o7 X4 f% X9 i+ g( f& ^, l
var marqueeheight=25
4 _9 {# Z5 B2 {; i* u6 t) C) _0 Q//速度(1-10)$ m- V% K7 v- V1 i$ V
var marqueespeed=3
$ o3 l) @6 w9 v+ L9 `3 q//背景颜色1 }; y# W. @! |
var marqueebgcolor="#FFFFFF"/ v. k: @+ K: a
//是否能暂停 (0=no. 1=yes)?% m) D! c9 _' @3 |- T/ g) ]
var pauseit=1' q- @9 C8 y- ?7 P& B
% l0 ]! s. A% z, D) `
//修改显示内容
6 H- x. O  D& T, k+ wvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
$ t  e1 b& q- {) V+ p: z( W9 ]: o/ \5 r/ W- K. [) N6 t: I

. W1 i4 t5 u8 E0 u- V////下面不需改变////////////6 P6 `( t% D6 Z6 Y2 Z# g
. S/ M6 T+ i3 H9 Q1 y
var copyspeed=marqueespeed% D9 G1 u7 S" n' L+ W# H
var pausespeed=(pauseit==0)? copyspeed: 0- u& w; R! Z: s( Q7 n
var iedom=document.all||document.getElementById
- g( T# q8 Q0 h; w: }4 e/ c& Pif (iedom)) t& o8 Y+ ~; v8 B1 X
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 k  m! \( D+ y* [var actualwidth=''2 V6 e7 ?1 Z2 d- }# Z
var cross_marquee, ns_marquee
! D; k4 T3 z" L# `3 E
2 M* w( F! A& @: l' |7 a0 H3 Xfunction populate(){
/ B* u% w+ I# ~+ z; V1 B5 Wif (iedom){
/ T3 ]& s  N  s7 Vcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
0 L- @  i$ C6 {cross_marquee.style.left=marqueewidth+8
; p5 a, h7 i+ f# P$ M+ ^3 Icross_marquee.innerHTML=marqueecontent/ `) ^5 }- ~7 R$ f# u/ ^4 J# a% d
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth4 [# j- `3 T) `6 Z/ E- U0 q0 x
}
7 x$ K7 v$ E; Nelse if (document.layers){5 J1 o: Z& O& X+ H! n5 M! ~
ns_marquee=document.ns_marquee.document.ns_marquee2) \. B5 ^3 z& i7 _8 `
ns_marquee.left=marqueewidth+8
4 Q7 D& O! ]" \: ?6 i  gns_marquee.document.write(marqueecontent)
$ d4 [( ]+ o. b- t/ e7 P& ~ns_marquee.document.close()- h- x( s! @9 `  [
actualwidth=ns_marquee.document.width
  L  D! L1 r: u' \8 R* Z}. V6 s- _( K5 s+ ?  l* h
lefttime=setInterval("scrollmarquee()",20)
) r/ A! n! d5 E# n# Z: k. u}& |3 m- S# }+ }! D  E3 N  D
window.onload=populate4 p( d2 [5 h/ F/ ~* c. q/ c7 q5 s
0 y5 x9 V" F+ X2 \  N
function scrollmarquee(){/ m  V. |- R: [+ h, m
if (iedom){
* _+ E0 D. S# X) Xif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
; e% D3 u2 Q: ]& G/ r7 Pcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 z& m. y+ h* E2 ]
else
! A+ }/ T4 P. F( tcross_marquee.style.left=marqueewidth+85 D0 o4 G! |/ Z/ _8 Z9 D

+ \/ }1 H0 U0 L2 V8 D( A/ i9 l4 ?}
: p! E2 x' i! _9 t. z) A$ _else if (document.layers){5 g# p4 g8 U, f' j0 m* v3 m
if (ns_marquee.left>(actualwidth*(-1)+8))
+ _' v! T: W' o3 [/ W6 N) ons_marquee.left-=copyspeed, L6 F) U# L3 A0 B1 d% y1 v
else
" o) N1 F5 ?, a6 [ns_marquee.left=marqueewidth+8% \: _; f! t9 q4 \* U# I6 F
}9 |, Y, q: ^" |/ g4 Q  I' P- h; F% ]
}
* m0 l5 j( w0 f; @% Z1 f1 X) C
! U% R# G5 L0 N; v' q' H+ j: @if (iedom||document.layers){
9 \  r! m+ m$ dwith (document){
' i8 u9 ~% s" v, _8 D' Rdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
4 ?3 v4 ^$ B9 C% ]0 Z* R  p$ U1 dif (iedom){
8 ^6 `8 R) {6 wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 S$ W0 p$ b  L& m' l( G) Z9 W, Ewrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 }- F% ~' g% C$ J; F  z4 t
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
* w8 P0 i8 h* K0 t) Rwrite('</div>')7 y2 ]. w" ]0 W' r+ [
}$ E4 P4 [2 S6 U9 @: j* J
else if (document.layers){
' N7 |3 I2 a" z& c! Mwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
5 F) p8 z4 b1 k7 k6 Uwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')# S3 Y; x2 k1 }6 C, m
write('</ilayer>')
) B$ x8 e6 a3 a2 z! b8 q) A) U' Z}: X4 R8 B6 d" d0 B5 j% S
document.write('</td></table>')) n+ v2 H3 J4 p
}
, I9 m4 C1 u, _) P5 f- _) l$ S5 J}
/ e* N% \: i+ m, q4 ]</script>

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