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

|
网页之跑马灯文字特效
//修改宽度. k0 Y0 E! p: o+ G( r
var marqueewidth=300
8 p, u3 y, |3 Q//高度
$ C0 ^, P! K2 j" I3 B$ _var marqueeheight=25
9 f4 d/ R& @$ A! C# K. T5 c$ b9 C//速度(1-10)
6 _4 X: n* `$ ]4 Z, yvar marqueespeed=3
2 y9 j5 @( C7 U' O- ?* U//背景颜色 K, N. R' m" M
var marqueebgcolor="#FFFFFF"7 k: K4 X" E4 T& @$ D( c. g: G
//是否能暂停 (0=no. 1=yes)?3 M. I- w3 \# T u1 F/ ~9 X6 c
var pauseit=1+ I3 N* p8 f+ I2 k7 ^0 Z/ h
3 X# d) }# u5 f: O- x
//修改显示内容
* g! N! t r2 [3 o. e n3 ?" ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
) g9 B6 l$ H: u" b' v! r: m& W0 k. F) R2 @, A: Y/ ]
9 U9 Z! b# I; q1 o b J3 @+ ~/ ]////下面不需改变////////////1 q. r' l; u- m" z7 b( |% M6 J
# B5 J: G! M3 q* u- ~/ y j1 }
var copyspeed=marqueespeed
/ X" k$ I( \; wvar pausespeed=(pauseit==0)? copyspeed: 0& ~' w6 K& n, x3 c5 c
var iedom=document.all||document.getElementById
+ A7 S: a9 ` R3 n& l: E6 O7 }% ~* kif (iedom)
. J1 ]6 w4 L1 b; Edocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
e! ]; v4 g5 ^9 I- J! }var actualwidth=''
3 r, U* D2 M+ a \7 B) B' vvar cross_marquee, ns_marquee5 @0 N, j7 F- J3 w( k1 d) z
$ D. w4 n9 G3 ]& }* J/ I
function populate(){1 l2 K- a) c3 ]/ v; X5 U
if (iedom){
3 h4 L( u- t6 }2 @cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee. f% Q9 J" S9 Q4 I8 ~/ K: x
cross_marquee.style.left=marqueewidth+8
9 j, q W$ L3 N& O+ T9 Rcross_marquee.innerHTML=marqueecontent: x! b- z5 z0 [
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth( {" n6 I/ m6 k; q/ V1 I+ h9 v' S( T
}
, J8 Y" b7 F$ N% n/ O, Y1 Jelse if (document.layers){
" j0 O+ x) A2 {9 n; N5 M$ J1 Zns_marquee=document.ns_marquee.document.ns_marquee22 Y* }5 p( x4 r6 s7 O
ns_marquee.left=marqueewidth+8
" \0 f! Y1 G& O5 Hns_marquee.document.write(marqueecontent)7 e1 x( _2 I1 v8 L c6 o( ^
ns_marquee.document.close()
: O2 P' H" B% ^1 o8 f2 qactualwidth=ns_marquee.document.width
- c, F* N/ C8 t9 {" @3 m}
9 k9 d l5 h7 _& I4 u1 h: xlefttime=setInterval("scrollmarquee()",20)
0 v; l2 i# ^4 S& u9 B% b# ]; |}" t* F' B6 C; q6 \8 r& u# a
window.onload=populate
( r7 u( O# Q7 O1 H$ C6 k
) @$ l1 K/ _ vfunction scrollmarquee(){
! G' m3 F: z! ?! S6 U/ aif (iedom){
) d* h y* a0 ~4 _# D3 jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
2 o( n/ h, Q6 h6 [cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed" B: f; l8 E' x1 z) K0 P
else, F8 w" V0 I0 h/ r Y9 v
cross_marquee.style.left=marqueewidth+82 |; _; Q9 a8 z s8 P1 f7 ^
/ {# G6 o+ J# g( G" `! p}( h: x0 m9 A6 a+ c
else if (document.layers){
6 w; w" y$ W' A6 U- {8 q* b# o" @if (ns_marquee.left>(actualwidth*(-1)+8))/ {$ U' d3 o! X7 ?5 n
ns_marquee.left-=copyspeed7 q3 p" y6 a$ U# Y; E1 A2 u
else# v5 x9 m8 t) V7 F8 V
ns_marquee.left=marqueewidth+8
m- o& J+ h; f i0 d2 j}8 @# G$ B6 r! {3 x- T
}
$ d6 g1 o; ^3 F( S% T. e( w; V: U; h/ `
if (iedom||document.layers){, k# |2 R9 _1 G/ W) J$ l
with (document){
$ x- R% N# {0 h: o& {2 jdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')# j( h8 c3 [& I6 j
if (iedom){! V9 Q$ D7 L" f" }0 y8 i+ O
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')) V1 g3 d9 A+ F+ {. ~/ ^: b% P% }
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')$ q* u4 }% G3 A5 L0 E, \7 H
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')3 T5 [7 N1 o2 q
write('</div>')
! {9 y& W2 C6 o0 s! ^0 F: M}6 P& f3 C+ K C1 c
else if (document.layers){
f" X$ J8 X b8 p/ j1 j1 \write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')( q/ K# r5 `$ V) F1 l' u0 K! p
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')/ K0 N5 c( u, _+ t7 q. N. S
write('</ilayer>')
; G7 b5 f2 \, b) N! D}
# G1 Q$ y9 ^* a+ mdocument.write('</td></table>')
6 \5 ]2 V, X4 b! Z7 l# S7 g( E}5 B, ?3 m; r7 j5 }1 M; U
}+ l4 v% T; a; ~, \4 `
</script> |
|