|
  
- UID
- 133
- 帖子
- 51
- 精华
- 1
- 积分
- 186
- 金币
- 55
- 威望
- 2
- 贡献
- 0

|
网页之跑马灯文字特效
//修改宽度3 s8 O( c& `9 j2 i# N6 Q4 h$ Y
var marqueewidth=300# e Z+ W/ F& k7 }
//高度" O/ p' X7 A! T2 p8 r$ N
var marqueeheight=25
. |( F5 I' \5 q, X; I: U4 e3 w! }//速度(1-10) M7 {. T8 I/ ]! E. Q3 g( R! D
var marqueespeed=3
9 b0 Y- F2 r0 q) P//背景颜色
: ]4 W! ]2 h2 W8 w& rvar marqueebgcolor="#FFFFFF"; G5 ?5 z; }$ }% L+ ?! P( C; F
//是否能暂停 (0=no. 1=yes)?
4 {; s. B7 @& W( ^4 }3 O+ s/ jvar pauseit=1$ C% b8 |' ]# W1 w/ i! f
$ t) H6 J$ s1 K' h( [
//修改显示内容
" E6 s$ E+ h/ m: E2 uvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'$ r/ W. @6 j$ M0 l" P) w- k/ E n! |
; l. |" _9 A: R' R4 ^( |2 g
* g& y) _ ^5 V4 _# e////下面不需改变////////////
' ^! G" [6 O- \0 b$ P2 W
& f, H" P" P# a! x) @# Rvar copyspeed=marqueespeed
5 L! U `# @2 k! e4 l- U( k' svar pausespeed=(pauseit==0)? copyspeed: 0
. \ X+ A' P$ K, }2 b$ Y5 c* C L5 kvar iedom=document.all||document.getElementById' V# z! j L3 U: R- c* H8 v
if (iedom)
w! o5 K0 h2 h1 Z; x( ?document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
9 M7 i: y& p1 V9 uvar actualwidth=''2 q0 W# M; m0 V8 ]
var cross_marquee, ns_marquee0 N# j1 h: n1 C/ H: y3 g
1 @8 j! F( x( a; k
function populate(){
) K" q( b" i; J0 U5 Uif (iedom){# k. o$ O% c" J. I4 f5 U
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee% s) _4 [7 @' J/ t& k3 x% ~% {$ Z
cross_marquee.style.left=marqueewidth+88 [# S5 t/ _$ e; K L2 Y# v1 \
cross_marquee.innerHTML=marqueecontent
& F0 _1 k/ C+ Y# z' R Sactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth- r9 K" r% G8 {2 V1 P$ R) E% D
}
7 ?; A0 |' H' b# `- Zelse if (document.layers){
7 g4 U7 |3 c6 s D1 ins_marquee=document.ns_marquee.document.ns_marquee2# Z0 }* B1 _6 C7 o+ x% e: L. \
ns_marquee.left=marqueewidth+80 r! J9 M1 A/ R; U* G3 u% i
ns_marquee.document.write(marqueecontent) J. j3 I+ k6 U$ i# H# B0 @
ns_marquee.document.close()4 D1 h$ T- A8 I5 p! j M$ N
actualwidth=ns_marquee.document.width
, [5 V1 j, b1 e! c: U. f; ?* s}
3 g# F# C/ ]: T7 Q2 Llefttime=setInterval("scrollmarquee()",20)
3 @3 B2 v7 s0 p2 r7 K$ S" Q+ w}3 m+ e* o/ F4 [. Q1 A
window.onload=populate
' O8 U( p% j4 O7 C8 d) S/ U/ `/ M- t
function scrollmarquee(){4 z: z1 \8 n: ^
if (iedom){. p$ ^ l5 R% E
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))3 n; @0 G( p+ Z" b# E* s9 z8 l
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
: N( |4 I; ^, [0 Celse
" Y5 Z; e7 C7 I! Q+ bcross_marquee.style.left=marqueewidth+8
/ F9 \. @6 Q I" u9 V9 y0 Y, k( H% }4 t6 J% j
}) J$ w( ^9 T1 ~) ?" R0 Z( D
else if (document.layers){1 j3 Z# Y* s" E" `! I
if (ns_marquee.left>(actualwidth*(-1)+8))3 \; }% v U& w) E ~
ns_marquee.left-=copyspeed2 h' ^" x( ~8 ~: l3 _
else# Y4 j# c* ]( D! e) h- e
ns_marquee.left=marqueewidth+8
" @! p/ F- u5 F1 i# h: C}
, a, w: r+ r+ u w$ h( Q( Z7 `}
7 `: Y4 |- h' z7 _8 K( W5 p, N# v! L8 o4 [/ |$ X" k( A
if (iedom||document.layers){
0 Q* A3 J8 Y4 g6 `" B, S `with (document){
) j2 |( s1 e- H3 b" m. O7 R+ t/ Ddocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>'), i& x& _% Z0 Q; L
if (iedom){! ]) S9 `" ?% C& z+ ]
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
6 H3 q. s7 [$ P/ gwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')/ _, U# G( `8 i) M0 S& S' I# P9 T
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
6 V: z; x3 ]4 a' Y7 @write('</div>')
7 W0 _. j) h; d' {; P2 s1 R}2 @. P) f: O' Y3 h% ?
else if (document.layers){
7 g% K" @! u S' rwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
$ |% W! G: N% }: [& {2 e& {write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')6 W5 ^" Z1 M4 B+ [+ v
write('</ilayer>')5 {; r5 J8 w7 x4 ]8 V5 E
}4 z, a- l, }; J B1 C
document.write('</td></table>')
" K4 v# H! {4 [5 d C' g% \" y}0 G& G% W* g% f
}7 L8 e# Z* {5 e5 i
</script> |
|