返回列表 发帖

网页之跑马灯文字特效

//修改宽度
5 Q& A! \- f( g! [, Xvar marqueewidth=300( D  K' R2 u+ T, t
//高度
% e0 c0 Y1 U) S1 c, }* @2 G4 Rvar marqueeheight=255 f; N+ y, D% l0 A8 R0 q
//速度(1-10)
4 W% t5 k- n5 {( evar marqueespeed=3
/ E2 G& @. }% U$ d% b//背景颜色& J4 ^5 J3 r9 J+ t; p% E' S
var marqueebgcolor="#FFFFFF"$ g5 J+ m  L4 z: j; V9 d# B& v0 ^
//是否能暂停 (0=no. 1=yes)?9 t2 w7 k7 Y, h0 }& f& u2 S" D6 t' M
var pauseit=1
2 u) U# m! R8 A) I' U0 H' r$ I& |$ g' |8 E5 R* R
//修改显示内容8 C) y) F7 i' g  V0 Z
var marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'# O  T6 O+ H5 f, {5 d
* _  o# X% ~  g: a( K6 q" M7 o
- v! ]' D1 k9 `- F/ U' D5 ~
////下面不需改变////////////' R0 `4 C6 z) i2 `
1 a: Y9 x5 ?; I$ ^; x3 D9 x
var copyspeed=marqueespeed
  V3 \( v- h7 n) p2 rvar pausespeed=(pauseit==0)? copyspeed: 0
) m) i) E1 S8 ~* l4 Svar iedom=document.all||document.getElementById
- L8 m. b: f) gif (iedom): ?5 ]2 U8 V; N2 {2 A/ n6 l5 s! E2 R
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
! q+ s9 _! b/ V$ n; Q0 s3 _9 W5 vvar actualwidth=''6 D5 ~" [) ?5 \; k3 o
var cross_marquee, ns_marquee2 G" P/ H2 f4 a8 r. X/ m3 p; ?

! L" L% u( m+ I+ z! Qfunction populate(){
8 [4 B. M8 n3 Bif (iedom){& a" o3 C, V! i9 ~
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
9 w8 f" p5 p$ q) T0 Kcross_marquee.style.left=marqueewidth+8
; ^5 `) g/ P. k. Y( \4 c  Scross_marquee.innerHTML=marqueecontent
6 z9 V. m5 Q* F9 Factualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth& K0 c3 P# i( T% I, d
}
6 j/ ~, J3 Q: Velse if (document.layers){
: N6 q) q. Q7 ]' T& H- e) z7 M! rns_marquee=document.ns_marquee.document.ns_marquee2
: {* d4 R9 C# S1 m7 D8 E0 R, Lns_marquee.left=marqueewidth+8
& i" E  `3 [; \/ U( r  e& Zns_marquee.document.write(marqueecontent)
0 d9 i! p1 P) ^" Ons_marquee.document.close()5 q0 w' L( h7 z, \% h
actualwidth=ns_marquee.document.width
1 f: G6 X& B, u' }0 O( X. g) T}
# z# u: m* {( clefttime=setInterval("scrollmarquee()",20)
( d' \" e$ Q& U/ R}$ T1 N: N4 ?0 ^4 j
window.onload=populate* h6 ^* \& |. D* l/ H
1 ]( }, ~% H) X# I0 `' V; O/ n$ F
function scrollmarquee(){( p4 F% _1 ?( O, \0 t4 A
if (iedom){
" W# H5 I2 e, J) P# Jif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
, V, m: Y& e' _. kcross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed# l7 A9 l: d$ ], [
else6 N# G- ^* `( E7 o8 @
cross_marquee.style.left=marqueewidth+8, G, f, c% P2 h! a

. g+ j1 l* ^2 |" V: D}5 [9 O  z7 ~1 R" ~, g' B- J* E: e
else if (document.layers){
; h  S' ?: n5 Oif (ns_marquee.left>(actualwidth*(-1)+8))
0 q; |9 T, a: b8 F0 jns_marquee.left-=copyspeed
  l& s$ d9 `- H5 Celse
* f: T" f2 [4 S' }: Gns_marquee.left=marqueewidth+8
9 F/ ~$ a  M; v) i: E* `}
9 W( N* D8 F/ M- a. i" n}6 Z, m4 ]7 R& j

. ^* |" E$ E/ K: Kif (iedom||document.layers){8 d9 j- M$ N+ Y' J, C- P
with (document){1 B* g) h4 z6 A1 i* V
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')$ f& B+ E; {  T
if (iedom){: d, U7 P- R% @) Y1 C# H/ X
write('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')" l9 ~* N2 r$ c- Z8 \9 Q0 c
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
" a3 l% W4 o6 E# R! h& Owrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
+ H1 v4 B! @2 I5 ~write('</div>')
3 q% \5 S* ]' S6 O/ r$ T# D}7 M# M1 @7 @7 ]: B6 T# `- s
else if (document.layers){
& [& O- s5 p' L* O3 }write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>'); o( H; I( E6 O7 R
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
9 j6 `6 P; ?% ~: g/ [4 D# Awrite('</ilayer>')
1 U. }" b  r% A# _' V, C5 O; r- ?}2 B$ p* P! ?% I8 H
document.write('</td></table>')- a3 r( O1 e6 G
}
: j/ Y$ H9 Y/ |& ?; K}
% _6 M( [; \( E/ e; z</script>

返回列表
【捌玖网络】已经运行: