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

|
网页之跑马灯文字特效
//修改宽度# |% O7 I- Y) d' u$ a) ~
var marqueewidth=300
$ W) j& t8 ]: y3 T w4 F$ B//高度
, B0 E5 \: m# L- G* r, N; wvar marqueeheight=259 s9 H9 n' {: j1 j! t
//速度(1-10)
1 C" b+ Q* K# j" b7 }: Yvar marqueespeed=3
# _# L) G) k: e* C- l4 f3 r3 U# `//背景颜色 l& t* [$ D @4 A, _
var marqueebgcolor="#FFFFFF"# J& Z8 i- x' ~5 u) ~/ b
//是否能暂停 (0=no. 1=yes)?/ j+ F: A: m M5 `
var pauseit=1
& \- z( G9 Z! t+ b8 _4 D9 R
. T! c% o% S! `//修改显示内容
8 G# F: n% k0 i( X0 D" ?( Z- lvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
: _7 s! {9 H6 n/ `
, D4 X+ x& [" v" l( U$ v
3 t6 i( r. u9 `" w1 z- K* {0 C' _////下面不需改变////////////
+ `6 ?$ T/ z+ q2 }; V: o) \0 G* p; _+ Z! N) a
var copyspeed=marqueespeed$ c$ ]: H B5 P) b
var pausespeed=(pauseit==0)? copyspeed: 0
+ N( `* ?: @, U7 f+ Q; Uvar iedom=document.all||document.getElementById1 P) ]: c6 a2 l2 v! e
if (iedom)
4 _+ h* c5 I3 d1 Hdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')- r8 D1 x, Y6 R% e$ t9 M7 l
var actualwidth=''* }0 U2 @; N2 c- {# [+ K- N% E
var cross_marquee, ns_marquee; \' K% K5 b1 B' } s# v1 o
3 J' l$ l. c0 r( j- m
function populate(){4 _# w4 f1 \# N0 j# e* j K" [5 S
if (iedom){
6 `! O9 o: Q# l6 z( G: Ecross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
* |0 C: K6 y4 x/ B" Ycross_marquee.style.left=marqueewidth+8
! v0 w; M+ y$ A" C7 ~2 mcross_marquee.innerHTML=marqueecontent
; X/ F: A( ~. b/ \1 [/ \5 kactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
, |4 ~8 `" O( o$ L}
) W9 r' b' V& ^) velse if (document.layers){
# J9 r* f, [7 @& z$ A0 X) R# hns_marquee=document.ns_marquee.document.ns_marquee2! D8 b8 z5 b' m/ r5 E: X
ns_marquee.left=marqueewidth+80 @2 }/ R# e. f
ns_marquee.document.write(marqueecontent)$ `8 v1 G- {2 m
ns_marquee.document.close()
, r, ?, P- t W4 o3 Q- O. yactualwidth=ns_marquee.document.width
/ d" h/ k, b8 X/ F}% Z# S& E' h- j& ]/ Q; K
lefttime=setInterval("scrollmarquee()",20)
, a: C s3 L* c) `}, M" N8 T, [9 S
window.onload=populate. i, l, ]- C K5 @2 F" C
9 G4 J! j* J8 U
function scrollmarquee(){, v! r. H( |: B
if (iedom){
& N! b% b# x6 l! Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 [- F" K2 K2 j5 a( y" Ocross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed) ?( p o, w; i1 z- n0 F; s5 U
else
' P+ b6 [/ k% x! t/ j- Bcross_marquee.style.left=marqueewidth+8
! K6 d$ W! g7 m6 h$ X8 v
! e) j; s3 e/ z" J' k}0 Z0 |; T" C% ?) J
else if (document.layers){5 I& `8 V/ Q' }2 ?$ i; \
if (ns_marquee.left>(actualwidth*(-1)+8))
" G W3 o9 z/ L$ h% ^ns_marquee.left-=copyspeed
' a8 ]- g/ H$ g$ Xelse+ y& @; B; q/ `1 v
ns_marquee.left=marqueewidth+8/ o4 f, e) Q$ G; u$ S3 Z$ C: e
}
( X1 u1 i' ]$ `) |; R, c}
6 x: @5 O, K6 o# r6 i* T
5 F) x! J! r0 ^& g5 K6 `( Tif (iedom||document.layers){
7 r I" }# i1 l4 Y/ h; W( i8 nwith (document){
) L: G7 W1 b. zdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
" }1 v/ Q2 {" A/ U# I- w$ Z- {if (iedom){3 Z% x# u0 w: k/ P6 r3 {2 n( H5 E
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')# x7 _$ S; |4 F; q
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" B7 E( Z. a* {( l) a4 Z# twrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 O( W# I6 ^( {$ A5 e
write('</div>')5 a3 f6 C, f$ h7 M5 `! V& E
}
: _9 W+ e" V% a6 uelse if (document.layers){' G3 P3 C- }+ Z& `* `( K% {
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 n* U9 e5 z# V4 @9 N3 B& fwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')9 R! n* L4 G/ `5 b
write('</ilayer>')
* Y5 h( y! W2 M& S1 N% Z4 ^}
, k( W) I% `1 @. E' S$ T& Qdocument.write('</td></table>')
5 T9 q5 F4 O" V; h5 N& ^; @}
7 F) x& M! |9 S2 l; v}
$ X$ _: D- f! i" Z. g# D4 W</script> |
|