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

|
网页之跑马灯文字特效
//修改宽度
: I! f9 N6 k& a# I+ h2 {var marqueewidth=300- G) e0 H* `8 r! \$ t
//高度+ y ^5 {$ i: d G6 y( }
var marqueeheight=25
/ y( M4 R% `! @+ w//速度(1-10)% Z+ x7 G2 m# d; G& r
var marqueespeed=3
& H: L$ q5 \* o//背景颜色
0 g% s0 @6 R: q }+ Gvar marqueebgcolor="#FFFFFF"2 O; ]7 P- N/ x, U! }8 `. x
//是否能暂停 (0=no. 1=yes)?
{1 @2 F1 o: R1 r6 @2 G8 Mvar pauseit=1
. e( X) A" s3 E* {4 a+ [
" N4 z" K! `+ ^; y4 O% {//修改显示内容
$ \& w3 M* |* q! B* H6 C6 g1 @var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'; a2 N) W& Z5 T* q& s: n
+ E, x( V: ^& T! K& r/ k
) Z% s6 `- X! \* p////下面不需改变////////////
% l$ H6 B, |+ Z. r1 j+ l P3 J; ^) V
var copyspeed=marqueespeed) d1 M3 R2 t3 J% k
var pausespeed=(pauseit==0)? copyspeed: 0
! R5 h# L! C, Y$ F5 f; a+ Ivar iedom=document.all||document.getElementById* u: F7 ~7 E! D0 }$ v, Q% l* L& B
if (iedom)
B# s' R2 ?; Ydocument.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
+ }1 V( R6 o5 D2 f" ?/ e+ T: E5 Bvar actualwidth=''3 Z8 Z" G9 u- S! m- r4 |; F8 r
var cross_marquee, ns_marquee
! S. _3 j1 ~0 h* R: |1 f' z7 z, L0 s; v
function populate(){
% e& R$ w. b- e) Y) [6 bif (iedom){ I' }( X9 L* A2 c. K8 |2 o
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
+ G" Y$ p# _4 _( v* Q, a! ^% pcross_marquee.style.left=marqueewidth+8; ?) V1 A; m" S4 O5 u$ D$ P) _
cross_marquee.innerHTML=marqueecontent$ W* M) R$ {% _3 |* Z
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 b# B4 z$ L/ H
}9 Y4 x: `0 k) M# c" H
else if (document.layers){- S$ V& X' U: P# c. p& S, G, g
ns_marquee=document.ns_marquee.document.ns_marquee2
1 S0 Q! D+ [, a& dns_marquee.left=marqueewidth+86 n. h1 c8 B$ |3 X, Z7 U8 `) ~
ns_marquee.document.write(marqueecontent)
& R2 a @( p- k5 T' c( |0 A k2 dns_marquee.document.close()
# h! @% {: J4 `7 z& L. yactualwidth=ns_marquee.document.width
1 D3 T2 m6 R4 Y4 s}3 j# m4 b1 Z9 c3 ]! c/ m) R# h
lefttime=setInterval("scrollmarquee()",20)
5 O( f6 @) u7 k, m}) m% ]% k1 \- U! u3 d6 K1 d
window.onload=populate
% b/ o" P& Z4 \7 P2 m& R" Q: ]: |& v h7 A
function scrollmarquee(){2 h# o% h; f a% ~) H" `3 |
if (iedom){
: ^+ X3 `0 w% x! m) Uif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
# n/ _: ~. d, ? J! \0 G6 vcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed1 P4 B$ T4 Y% J2 \' ^/ c! A2 Z* _
else
5 ^. S; A/ A V/ across_marquee.style.left=marqueewidth+88 X" Q& ?& c% ~) \! c6 G+ f
. v" f+ j" Q+ i' [( Z' K& y
}
. W8 R( E& k6 w; @else if (document.layers){
1 V! V2 l Z' D% Dif (ns_marquee.left>(actualwidth*(-1)+8))9 o. l" Z9 i. U
ns_marquee.left-=copyspeed
8 F; e0 E+ M, R% Oelse
# P) R L7 c8 f1 Q5 O! bns_marquee.left=marqueewidth+8/ X: O) V# L* s6 \* o9 }
}
: w4 P/ z7 R" Z, Q) I: B} ~- @! F5 S- [# _* f
# w" R- T b3 a7 n5 N, V/ k: a
if (iedom||document.layers){
* H& _6 v+ m* x" b. f- Kwith (document){* J0 u8 }2 L9 _6 c/ H6 ~" m$ `
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
- {7 G+ B+ W4 e4 b Tif (iedom){) w( Y( E, I) `1 B
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
* N. z7 r( \! V5 M1 g5 {. Vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" T- Q% U: Q. N( R2 `' Bwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'); U, [' X) @, ?
write('</div>')
6 \. _: H( i( f4 s* y# [& A}" W/ z: C) g4 t; K3 A' ~
else if (document.layers){
6 w5 J5 g+ G. p& {write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
# S4 e2 ]0 K7 E/ n2 L) n6 \: xwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
, H) t2 ~+ M# ~: {write('</ilayer>')
/ |$ M( P* n$ q- O% n! y9 ?}
8 K3 u% b3 U! a2 A0 Ndocument.write('</td></table>')
" ~! U* Q& Q8 z}
7 t' Q7 x$ w( w$ t" T}
( a) e! C" ?1 ~# s# J( M</script> |
|