返回列表 发帖

网页之跑马灯文字特效

//修改宽度- T0 A" Z  z3 X. _
var marqueewidth=300! ~- Q4 o7 e. `: ?
//高度
/ }+ y: C0 N7 dvar marqueeheight=25
8 ^0 p( i, v3 n; Q//速度(1-10)
, j) m1 I/ U! S' T3 {; f( M9 Qvar marqueespeed=3" m0 m! t7 {) W0 }. E1 ~+ g0 |
//背景颜色
6 K* s1 m$ R5 Yvar marqueebgcolor="#FFFFFF"
: V6 _& p! ]1 p( ~) j' ^. j/ F. e//是否能暂停 (0=no. 1=yes)?
$ D0 X3 y3 \9 Y& A! g# Vvar pauseit=1
, ~2 O) M( z7 d3 Z; Q3 j3 {+ L2 T0 W& z7 s1 L
//修改显示内容# G$ E# H  r/ R6 W: d! [, l( E
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'7 i, ~! L# t$ [% k6 Y

5 ]3 O4 o/ e4 k  L, c: X0 q% b2 P
////下面不需改变////////////
9 N2 g# G" @: n% y' W) l0 F) d) D$ t9 r* Y3 @
var copyspeed=marqueespeed( o( Z8 r& D+ F
var pausespeed=(pauseit==0)? copyspeed: 0
; {; s! X, ~- F$ j/ wvar iedom=document.all||document.getElementById
5 U% ?# }$ t  k0 b3 e/ aif (iedom)
$ o% G# F: Y) Y) v' ?1 l  Odocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 @% B- w: `% @var actualwidth=''
4 Z6 f8 f( }5 P. Q4 y6 _9 Mvar cross_marquee, ns_marquee
. `1 B% N  K5 ]% r1 n/ W( c' f3 E( g0 X
function populate(){% y- v- a' F: `% O8 t
if (iedom){
. V  ~( E) x4 Z" D* K/ n( _# J% Dcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee' o+ G5 F; L/ @# o+ ?
cross_marquee.style.left=marqueewidth+8
( m0 p  q0 ?8 w* N+ e# E& V5 Across_marquee.innerHTML=marqueecontent# D' ?5 l) D+ n4 G- ]/ X! x6 s
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
0 B9 u% R9 r, L}0 x  ~9 \! q0 H3 K- p7 q
else if (document.layers){
! i7 j% h! q. Y, W; rns_marquee=document.ns_marquee.document.ns_marquee2
/ R9 t  t, U! c! o" q3 U/ s0 U9 Rns_marquee.left=marqueewidth+8
' X4 p# _2 [, U3 ^7 R5 [4 |/ b( mns_marquee.document.write(marqueecontent)
$ D" A, B0 Q8 T2 r9 `+ ], J+ \ns_marquee.document.close()
& L" h$ c/ J1 e% o- p9 b2 Q0 r4 nactualwidth=ns_marquee.document.width4 T7 g+ {1 x7 n* X8 l+ y# F, C
}3 I' }7 t3 j# ?- _  l; n
lefttime=setInterval("scrollmarquee()",20)
; a) v, \4 X; p& p! G" {; {}# U; i+ }# `& N' @3 ^
window.onload=populate
* C8 i8 v# f9 Q' J6 ]" Z, @0 W5 y  V; J
function scrollmarquee(){
: n* ?5 E9 L, x6 @if (iedom){
6 ~% z4 q4 T6 w, G; c( a2 n9 _if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
3 f! r* n! o/ across_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
2 H2 @8 f& l' Pelse
2 D: g# M9 x1 a$ ?cross_marquee.style.left=marqueewidth+8
: Y+ z0 |# L# {/ R2 U" {6 n
8 o# R- k' t( v) [* Q& e}) E1 G4 V' D1 Z# V9 N8 z  U
else if (document.layers){
1 z7 i$ u4 L( w( W  n, Rif (ns_marquee.left>(actualwidth*(-1)+8))
7 m2 g' h$ |% v' U  u. Nns_marquee.left-=copyspeed  p2 Q: L8 ]- t8 B0 e
else
: e9 q( m7 m# [+ O. dns_marquee.left=marqueewidth+8% d! J$ {- M0 O' d
}
! }0 ]0 \3 B' y, S* p}" M6 x5 Q: h2 ^; z4 t& |4 N, n- _

6 Z( u* k2 _# `/ q2 lif (iedom||document.layers){: R7 o5 }7 r5 g/ g7 a% w
with (document){9 i* i' Q9 i' y% m
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')8 n9 v3 l. _% X1 R1 O5 Z7 h0 i
if (iedom){9 [6 N0 F3 k7 K2 J+ y9 i
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')1 b! n" `  {+ ^' F( ^; H5 Y9 \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
: ?7 g! Y" f; o* L% C' F* uwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')2 S5 S+ D( l* x+ R- r
write('</div>')+ f& i: n, u. T& z$ x- s# d5 Y9 j
}- Y* E; X3 Q) ?4 G4 C+ ^" {  A
else if (document.layers){
/ Y( d% n+ {! e; B. Gwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')/ S/ b& E+ H7 @! ~( E( N2 S
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 M/ J! ^" K- a: h9 G
write('</ilayer>')
, [1 \' _/ T8 F& F}
9 c* ?1 \- d3 s$ D+ k+ M2 n- tdocument.write('</td></table>')( E, h  `' H0 R* X3 S  y% k5 V' [
}5 w) a$ }7 V& p
}) V3 |) O% W1 F3 q" T/ U5 C
</script>

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