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

|
网页之跑马灯文字特效
//修改宽度
% r- h% {6 M9 w2 b+ h! Lvar marqueewidth=300% A% m& F. v, o2 D* I
//高度
/ Z' A' g3 B) M$ g' ^1 F4 Zvar marqueeheight=25+ ?: p! ` u' c u1 L* x7 X
//速度(1-10)* V- P* X7 ^7 `" M% [! m
var marqueespeed=3
6 r/ S. @7 X# X//背景颜色
9 I' z$ T& v/ |' C$ {8 Q1 Pvar marqueebgcolor="#FFFFFF"
4 Q0 Y' y4 `9 l0 z9 D. z; K//是否能暂停 (0=no. 1=yes)?* p; s: @8 U n/ p
var pauseit=1
) p5 P. w7 M# x7 \& q1 i# w. r$ _3 X7 A) q n
//修改显示内容
; a C* \& |* Fvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>': ] j, S9 r0 ~4 _3 w* ^8 D; M
. F/ f7 V5 ^' Q0 |" f' \0 n
7 W# d1 W( V) f( f9 O* A8 H6 m////下面不需改变////////////8 ?! T6 G* l; X. k" t1 c1 T
7 w# G2 M5 J+ @4 h2 y
var copyspeed=marqueespeed5 S4 f' Q5 \6 f& W) A
var pausespeed=(pauseit==0)? copyspeed: 0( l! s- R2 E& C# Q5 z2 b8 g6 @
var iedom=document.all||document.getElementById$ T! p$ E' {7 G) L0 b. e
if (iedom)
. |1 P: E& V$ @, cdocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')' u2 Z9 A. T5 G( g/ V8 C* D& i9 t
var actualwidth=''
5 ] V o$ w$ F A5 Ivar cross_marquee, ns_marquee5 |5 \+ i, K: Q5 z5 U; S
6 A7 _1 x% X) Ffunction populate(){
2 u1 `* k5 }# F" Z9 F# B0 aif (iedom){/ |+ @& r q& r5 C! E
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ q* N, _8 d' y! j3 jcross_marquee.style.left=marqueewidth+8
6 S O7 O7 D' A4 s! h! Ncross_marquee.innerHTML=marqueecontent
5 }! f; n T$ f; F4 [actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth, V* |# y' |' X
}/ R! u W" k, X" D# h
else if (document.layers){
: _% _; [: B& xns_marquee=document.ns_marquee.document.ns_marquee20 p9 H) I& @8 _
ns_marquee.left=marqueewidth+87 N' W/ H( K, i4 d6 r+ V
ns_marquee.document.write(marqueecontent), c5 L' I2 O7 g& L' d7 M) b
ns_marquee.document.close()
% G6 \4 O) _, w( A. h. Ractualwidth=ns_marquee.document.width
" D; ]% X7 X, B8 k% I! R0 ?}+ j2 y8 z9 n( o: |/ s' o9 Y
lefttime=setInterval("scrollmarquee()",20)
2 g/ V" Y, |2 H* }5 l# v6 v}9 @) u# d: m# d4 W6 B
window.onload=populate! X7 V4 W Z4 v8 Y8 _
2 d) g0 K% x: X ^
function scrollmarquee(){
/ T& W+ r) A K' _6 rif (iedom){4 u2 y3 J6 B! a0 C+ k' T
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))- z, k, A2 S0 ] ^0 @) W" f
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed* o) m4 y- U: d4 `/ k
else
\9 D6 o: Z& n& y% m$ w1 h5 [; N/ ^cross_marquee.style.left=marqueewidth+8
' w3 {( @# M, |! |' a/ X, N' i8 `4 s7 E& i; Y
}
# ]6 p' X5 `7 Q, Melse if (document.layers){; d2 \2 h: T! [( g+ _- [
if (ns_marquee.left>(actualwidth*(-1)+8))! N) ~( z# x+ t
ns_marquee.left-=copyspeed
6 A* U+ ?7 g( M# [) _+ H2 K& Melse
3 e: }# B3 p6 h* E* M6 Z5 {3 Bns_marquee.left=marqueewidth+84 ]" f; e) ~! f: }- y! t9 q% l, O5 m+ {
}
7 q1 g6 g" `* U2 n# q# E% E# O}& G, s% j7 Q$ k* r
0 D9 |* B+ K5 c# w) s
if (iedom||document.layers){
. i; i) y" T, {1 Mwith (document){$ T- r4 K0 ? T" j# p; I* Y/ M7 W. I
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')% |* \6 k1 D3 {5 @* V5 z3 Q8 G! A
if (iedom){
' _4 N! D6 y3 mwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')' }1 ^- B# ^7 l
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')5 w4 H& `. t O0 o
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
, | ^ J: Y8 S5 [6 e; [write('</div>')
) e7 I4 v2 S2 s) o}
( n5 M# j: W7 O& u# P6 F# ielse if (document.layers){
0 M* R4 R7 a% n! x, w7 R7 twrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
9 K8 O0 G& p1 Y' R" }) B7 Awrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
4 y" t- M* Z1 Z) R7 n) |# S9 u! g) ^write('</ilayer>')
6 D( t5 o1 i- R0 p1 K}
- Q8 p* B1 K0 G$ ddocument.write('</td></table>')$ X% y' W# J" n0 ]' q. ^! A6 g
}
$ y3 X% i& B: i1 s}$ ~" B- t( r9 g/ N- j
</script> |
|