返回列表 发帖

网页之跑马灯文字特效

//修改宽度  u% L4 R  N/ f, p4 q2 X6 A7 O
var marqueewidth=300: R5 U! H6 }2 ~8 F" v' J0 b1 P$ P
//高度. M: W, _7 c& d1 Y) v
var marqueeheight=25% @' ?: r- L) K
//速度(1-10)
3 m$ s. ~. i% w: Uvar marqueespeed=3  a2 L3 Y1 `0 {( C. p
//背景颜色3 ~* B* E9 R! x* [$ G) v
var marqueebgcolor="#FFFFFF"; e; e3 S" U: a+ e
//是否能暂停 (0=no. 1=yes)?
$ ^& z- z) B$ ^5 d7 @var pauseit=10 t( u7 F: L3 e0 W
. z5 N! z- H& I& [6 y; I
//修改显示内容
7 m$ z+ R; s6 N. ^var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; T4 g8 Y) }0 D+ `5 r2 e! `3 j

/ I7 ^6 }6 {  L4 Y1 @
5 C0 \0 f5 c5 `- x5 T////下面不需改变////////////
+ D4 }; N( l2 d7 H9 S2 c, X8 c
( Y1 L# T9 a% l3 ?var copyspeed=marqueespeed% {& ~1 g7 e0 _9 f, I. L
var pausespeed=(pauseit==0)? copyspeed: 0) {! b- |; G7 e  p3 O5 `/ V$ l
var iedom=document.all||document.getElementById
0 w# n8 O3 [* n' y8 gif (iedom)* o* ~6 k7 F" Z! {
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')( I1 }6 N4 A5 {5 e4 U
var actualwidth=''
$ v+ b4 g) }. S0 d1 svar cross_marquee, ns_marquee5 _; K$ s% a( e6 q% h" C0 `

% E1 K5 A: P1 Q' ]function populate(){
& z, c3 @. B- O0 T( ^) \9 q# @if (iedom){/ e: z$ C# f& \% D- V+ T
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee: }: ?3 t' K2 i# R! o/ H. [
cross_marquee.style.left=marqueewidth+80 c' D' R$ E2 I% E( u; g
cross_marquee.innerHTML=marqueecontent
+ g, u- }/ J$ U* w* V+ Nactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
2 G. a$ A3 j1 L8 f0 \- P- K}- N1 [) @% l4 c/ ^
else if (document.layers){
" ^7 S5 j* H! \! y. [9 u5 b  Q! `! Z) H6 `ns_marquee=document.ns_marquee.document.ns_marquee2
! |/ |  @% N8 g7 f5 Ons_marquee.left=marqueewidth+80 d; }7 x* a" V# Q  B
ns_marquee.document.write(marqueecontent)
! @% L* j; C1 A4 fns_marquee.document.close()
* z2 x4 |8 D5 ^) T- V! t8 e; F1 sactualwidth=ns_marquee.document.width! p* A1 E6 b% K/ w: C4 v2 f% f
}
1 |* A( d. [% b% B4 Llefttime=setInterval("scrollmarquee()",20)# A- F; b$ O9 [, |2 b
}
; {7 R$ b3 l; A+ W; M- I+ @0 W/ Bwindow.onload=populate
9 ]4 C1 {' W( w- n3 ~: ~
/ X! H! V& T0 P2 w! zfunction scrollmarquee(){' g- H; @. K$ @7 \. e! p5 ]
if (iedom){
0 z' V# x8 K+ f, p0 v2 g; Q5 j4 aif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8)), s( b- b" ^, [/ ^
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
! D8 @: n. n9 \1 f# L; Q# Nelse
4 }( y3 |) X$ G4 ^4 icross_marquee.style.left=marqueewidth+8
, }; w: M. r- B+ c$ q% v
# \- w- H- M* D4 R0 w6 M}9 Q: D$ r$ f8 h0 ^
else if (document.layers){& E) s6 c* ?1 r: L
if (ns_marquee.left>(actualwidth*(-1)+8))
+ d+ j( [# ~+ a: \, ?  Dns_marquee.left-=copyspeed& j1 U4 t7 u/ X# H! ?
else
( g9 t% d$ N0 O0 N; d  e  D' |ns_marquee.left=marqueewidth+85 O  `8 f( P: _' P/ l8 ~+ s3 {
}3 P8 |3 q; V+ \: c
}# O1 g! [/ Q( _  f: K. q5 Q

- ?* K) [: E( |5 U. }if (iedom||document.layers){
+ `/ K3 }$ v# `% t2 @& swith (document){$ Q% b! A6 m1 a6 y# J/ j
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')3 z$ j. ^$ Q$ g8 m: e6 b% W. }
if (iedom){0 L+ S2 m( i& j2 p6 g! ?
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
4 D( W% J! I& M1 Xwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
( S2 s$ w1 A7 N% I1 Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); u/ W# {  ^; ^* [) P% A/ Y1 r
write('</div>')
- `) j5 {. S: ]4 Q5 ?}
/ U3 W; h9 t' a8 u8 N" S1 _# w4 Celse if (document.layers){+ i8 B5 N7 U6 ]
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
% K! n5 }3 p# ?6 F5 u- Twrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')3 R. p" G9 ~0 B8 L* m
write('</ilayer>')# @' {5 L; j- N3 ~. K+ w9 L
}/ _) D# q! V5 S# e
document.write('</td></table>')7 I2 A, s+ K+ g
}
4 V. J9 Z+ {: _' p. V}" l$ {. ]0 `" b& |! I6 u
</script>

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