返回列表 发帖

网页之跑马灯文字特效

//修改宽度1 Y& X- W9 @6 J! l: a/ ?
var marqueewidth=300
* _9 G) L8 v& Y! i% l4 \//高度
9 W) B8 r% r5 ~, w* |3 |6 fvar marqueeheight=251 v7 v0 ^) {  a' w7 ^3 K
//速度(1-10)
, @: L8 U1 W0 A* _$ x% ]# @var marqueespeed=3
1 M+ d2 F, P8 L//背景颜色3 R+ f- Z# V: p
var marqueebgcolor="#FFFFFF"
) b1 }  t- |$ u//是否能暂停 (0=no. 1=yes)?
' g' w5 @2 R/ x: n6 O7 e+ z7 N' B7 |var pauseit=1
: k% s+ _9 ?) v- s: N. Y0 f9 J
7 l- e5 H  A& @) \, r//修改显示内容
6 f2 E, ]( O2 i. {: D- gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'! t& u( V; A/ H- G" p
5 |  o- J6 U3 j/ Q( U7 r
! z! B3 p% ?2 u
////下面不需改变////////////3 A) b1 v  t' b, @5 I# A) m" o0 d# T1 P
& e. a) \9 f$ l  M+ C
var copyspeed=marqueespeed
* X6 C. Y: j- `- w! s8 V( @var pausespeed=(pauseit==0)? copyspeed: 0) q& e! e4 U) q, _$ g/ ?2 `
var iedom=document.all||document.getElementById# x4 `$ C6 t9 ?/ t
if (iedom)* Q9 D0 ]: g, y9 r& v- }
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: U5 Y7 C( @; Y7 {- Dvar actualwidth=''
! T! ~) g9 n6 O2 J: Ivar cross_marquee, ns_marquee
- Q9 P% E9 L0 m7 y; y( b8 Z8 _/ u' ]* k: U+ s9 t" B
function populate(){
, Q! t; |5 L$ M8 t- Dif (iedom){
3 Z$ U6 n- c6 y% across_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. W8 J3 i0 `7 {8 W, A
cross_marquee.style.left=marqueewidth+8- G% ?: x% F  L) @4 ~' J
cross_marquee.innerHTML=marqueecontent
6 o. U: z0 m: ^* C: P- Jactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
. x/ s0 e2 [% D" R}
0 v' v& i$ g0 |5 c9 v: t* belse if (document.layers){5 M. ~9 e0 E1 n' K& P8 P* @+ y: [3 f
ns_marquee=document.ns_marquee.document.ns_marquee2
3 p7 ?6 x3 L* Q5 ~5 M8 h; W* F3 Mns_marquee.left=marqueewidth+8' o. R% g4 n+ \% F9 ]' }2 j
ns_marquee.document.write(marqueecontent)
& W! N' O) p" M6 \! z( Qns_marquee.document.close()) ?1 v6 y0 G6 l3 o+ \
actualwidth=ns_marquee.document.width
5 A- S2 I1 F) ]/ C9 x}
: S4 h' g6 @# w7 I7 w5 S  r8 v# [lefttime=setInterval("scrollmarquee()",20)4 o# R7 u0 K( R# r/ o
}' l" o0 R7 @; \, w3 U% I1 |
window.onload=populate! w7 o) H0 ^, w7 ^9 b# r0 ~

9 J* Q& l, S% z1 p! I1 D+ ufunction scrollmarquee(){
- F, {2 ^0 J; e+ `( p' R: o# pif (iedom){
5 @) r7 L, P% D5 kif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))$ ]1 C5 S# S/ b% T8 ~4 h
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
1 b, E, Q# N5 ~& felse7 p; ~( Z) L( G( p
cross_marquee.style.left=marqueewidth+8$ Z: j) |; j3 \1 x7 i

! {( e* _8 `. _; `& [! C}5 A" @/ G2 a; |# m! |! D
else if (document.layers){  J: z& t, a% k  H+ p
if (ns_marquee.left>(actualwidth*(-1)+8))1 U; n3 i6 Z, r/ s( w
ns_marquee.left-=copyspeed
2 a; [5 @' s1 ]else
  p8 T% ^5 g3 Z# A& _6 M/ y/ W) lns_marquee.left=marqueewidth+8
4 a$ ~2 x9 N/ b3 z0 L}
/ T; r7 o2 {' d) j8 a}
# a$ E- q2 V5 }' k% d0 D& Q( O0 ?7 c; W0 w
if (iedom||document.layers){6 ]* ]' r1 `9 |- S$ z# K) g
with (document){
% B* P0 ]6 }! k( Q; j3 P/ d+ _document.write('<table border="0" cellspacing="0" cellpadding="0"><td>'); E8 Q+ e! h, I# l3 ~3 \  B' o8 Y: S8 g
if (iedom){% M, y* W% G) [4 o8 \4 p; @6 {8 R9 Y
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')  e( [# V8 O! i$ b- }; v& M6 d
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
% {$ Q) |8 S  S; |write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')/ |) s- T( ^5 N' L: F; S3 f
write('</div>')+ O  r7 [1 H3 Q. d6 Q
}
- e3 A: D, O) d- p0 V& }% I% I+ O5 Ielse if (document.layers){
% {3 w4 q* P; d5 }4 I6 w  ewrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')5 v5 M1 ^9 N* y; Q* J8 {1 K9 `- }
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ f; F8 r$ I  z* @# y
write('</ilayer>')
" D8 _8 d2 h" D; e}
% [3 \! p2 o" [4 ~( h: Cdocument.write('</td></table>')$ ~: R0 ^  i. S4 z6 t& B( [1 H: M
}% G7 ~+ s& Q7 x2 S. P( I
}
- \2 u2 y- F$ }* j</script>

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