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

|
网页之跑马灯文字特效
//修改宽度
% l' {# N+ k% ^9 Kvar marqueewidth=300' O l. Q; s6 y. e& ~* `
//高度. H" u% q$ M; ^, W, h* f: a" H
var marqueeheight=25! S0 Q R5 B& a' j d
//速度(1-10)/ F8 i2 s8 p2 x- I+ t9 q
var marqueespeed=3. J8 V& n X4 w! u1 C
//背景颜色
2 m T, l& e* R" a9 r6 e5 Evar marqueebgcolor="#FFFFFF"3 ]! K1 g4 R# w% Y7 {* ~( B
//是否能暂停 (0=no. 1=yes)? J0 f: p$ j! _* s" H3 P* G* z
var pauseit=1
! c; P5 k" s9 k4 _" z3 K: h, j: J6 l' K' D) X
//修改显示内容
/ X N- t! r7 |4 }" {8 a( M; gvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'% U! W5 r* i8 N7 K/ G6 R9 d$ ?
7 n- j4 a2 ~+ x: |9 C, u4 O5 F$ i- O
////下面不需改变////////////$ R) l+ e: M5 z' [! ~$ S8 t% U
+ I" p4 q, \% _1 n8 evar copyspeed=marqueespeed) o3 A8 Q: B* [
var pausespeed=(pauseit==0)? copyspeed: 0
_) j- i: |+ D9 C0 D! Mvar iedom=document.all||document.getElementById
7 k3 }( H9 l0 \7 Y- Rif (iedom)
8 C1 q7 r# X7 k1 j* ^5 P% ~* [document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
6 [; U/ _* D6 R, `5 zvar actualwidth=''9 c5 A4 i8 V% O6 b
var cross_marquee, ns_marquee4 m4 k6 n: j+ v* g. Y8 x
! h# G3 I+ ~: T$ {' x
function populate(){0 y0 [( D# n. f1 p! I% U+ |
if (iedom){5 y- A9 w' f% u3 C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee5 {2 d; b' m! `
cross_marquee.style.left=marqueewidth+82 p8 R4 f8 d* s" A% r7 } w
cross_marquee.innerHTML=marqueecontent0 }% V2 e' o3 N- P- [/ B6 E
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
) V5 m4 \, g- k8 d3 R0 b% E}
+ X% M# s4 L0 h$ Pelse if (document.layers){
9 d1 r; E9 T% v0 x: `2 {, g4 X I, Ens_marquee=document.ns_marquee.document.ns_marquee2
) _ w$ o8 ]2 e7 F) A5 s5 @ns_marquee.left=marqueewidth+8
- z9 r- v6 S& h) I, c9 m9 Jns_marquee.document.write(marqueecontent)' G! c7 w1 ^5 G4 Z/ Y
ns_marquee.document.close()
/ K: k3 S q5 a7 D$ [: c$ i- cactualwidth=ns_marquee.document.width
- J, B5 R9 T/ b8 Z8 f}
! h" f/ g* i# u8 `4 N+ A9 ]lefttime=setInterval("scrollmarquee()",20)
& A* d' x5 N. z$ X}+ }8 g+ W1 p5 c. f6 c' C" s" }
window.onload=populate
6 ]% f, E5 H! X3 `. ]6 H) j1 R& |1 N/ {8 L" {
function scrollmarquee(){
" L- K% J& R' ]- J: O" I" L- B3 n+ Oif (iedom){& V) M7 k" n; s: F& h7 z
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 z2 Q9 ?8 E$ J z4 K5 `, w, n
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed2 H* V, ?/ K0 Q- x
else
4 E6 `% o% h# _/ T: `) v( |- ~cross_marquee.style.left=marqueewidth+8
5 e; A5 p" C* g, C
# D2 Q3 k" j* ]. R( b, N}( W9 c4 f' i& O ~2 h
else if (document.layers){
3 a' Y% ~) n7 p$ gif (ns_marquee.left>(actualwidth*(-1)+8)); @" M2 N4 e- @1 q$ a( l5 T# Y: ^
ns_marquee.left-=copyspeed% f6 C) m+ i- p7 D
else" @* P! F) I% E* C2 {9 P, Y4 t
ns_marquee.left=marqueewidth+82 {: r% k7 D+ H4 _' J, A/ u
}
, @+ D/ t2 h' X% Z; g# x}$ H7 E/ A. m. R( R9 \
. Y' g+ l- h i
if (iedom||document.layers){
# j H0 m3 _" j: G) U! ]/ w9 ]0 }; Mwith (document){
7 c& K/ W8 l4 Q( u( X# d. Tdocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')- a# X4 d- X4 z* ?4 r X0 C
if (iedom){' W. X6 y' \9 P* @2 D
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 a4 q( |" n3 g$ z
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
) n- ]9 v( D/ t& y" q! C. |5 ?write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')1 q) R% i, }* p$ p$ Z# D
write('</div>')- q; ~% A% |; Y' z" q
}$ V9 @! ^) r8 c0 ] r
else if (document.layers){
+ X# e( \. X W; \4 ~0 U/ O, B% k( F2 ?write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')' T6 Y: d5 U) h8 \3 L* o
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
% C; V o8 Q" S3 f" ~write('</ilayer>'), d! x3 `+ e2 [3 ~, v1 l9 ?
}
. q* `0 {5 m- ~7 e1 j& W4 C; ~document.write('</td></table>')
0 r3 D0 f; L* D4 P3 ^0 M}) D5 @, h, W( F2 Y: v
}
2 ^- c3 c+ g6 g9 G3 U" W/ y# B6 p</script> |
|