返回列表 发帖

网页之跑马灯文字特效

//修改宽度3 \7 o0 n& F1 {% B
var marqueewidth=300
1 E/ z. a. l! |4 ~/ M: `//高度( x5 `, ?2 `* I) j3 T
var marqueeheight=25
  q5 H) h# `, i//速度(1-10)" A" i* Q9 d8 I% a5 L
var marqueespeed=3
6 W8 N: s% @3 @8 V' M. H6 |//背景颜色
. A4 O2 @) N  bvar marqueebgcolor="#FFFFFF"
; i) `, R$ L: O1 f//是否能暂停 (0=no. 1=yes)?
0 T, y$ d" G1 i' |- a; Fvar pauseit=1' |( J6 Y; |! c4 X: G2 d
" \6 J+ m5 y6 A0 F' j# L  d$ v
//修改显示内容
& q; z# y8 F7 nvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
( f* j0 V6 z& Q) \$ U! k2 P& U. j7 u( B: u6 z

, h0 b+ H0 @, D% B9 l+ _8 ?////下面不需改变////////////
# P$ e3 j* g! d8 n( K' \: D* o8 F, p% U1 m" Z# n! Z( P+ w
var copyspeed=marqueespeed3 X/ i: @- ?# R2 I) \/ v; H
var pausespeed=(pauseit==0)? copyspeed: 04 u( ^5 U+ p" f' H& g0 x! ~/ A
var iedom=document.all||document.getElementById
& y0 _( H- \+ Y6 x' _, U1 w: ?if (iedom)" y& Q, L) ^, w8 M
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
: E& K6 T* v5 ?3 ]var actualwidth=''- M6 D7 I; e: k6 k! O! @' z/ i4 b
var cross_marquee, ns_marquee
! o" d8 C/ Q' p( Z8 q4 V8 r* f; Y4 r! s1 B- O- R
function populate(){9 E  q8 X+ Y! e$ @1 _! A, a0 q  q1 M1 E
if (iedom){6 W' y9 w" [5 K( C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee1 q& k# I/ Q! _1 n5 N
cross_marquee.style.left=marqueewidth+8
: h) b% m0 Q' Z- ecross_marquee.innerHTML=marqueecontent
6 }# Z1 h5 ?6 K; ~6 aactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth: X9 F" A3 g9 Q7 ^2 M4 |
}8 d* A  f8 Q+ i1 b
else if (document.layers){
$ u/ {% e( s& i* c/ n2 ]! wns_marquee=document.ns_marquee.document.ns_marquee2: Z' b+ i/ z1 R8 z. `! F& k0 J
ns_marquee.left=marqueewidth+8
3 B/ f3 v. o, S, }  ans_marquee.document.write(marqueecontent)
$ w& S3 _, q1 T; Pns_marquee.document.close()% r/ j6 S$ i9 l5 o3 D* {
actualwidth=ns_marquee.document.width
0 A* B9 j. G( S) {9 q) P}2 h: N! c+ G# M* D
lefttime=setInterval("scrollmarquee()",20); j3 h" R: g- C9 v' g3 K
}. i6 c* f! N' {/ d0 C7 I
window.onload=populate
9 b* i6 m2 z3 P% Z5 d, H% d
- K- @' ]9 q. k$ k0 ~: Qfunction scrollmarquee(){+ L, {, n+ s2 w
if (iedom){4 F5 m/ Y9 @  [! D& ^* t4 O
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))
9 N5 Q6 g, d6 Z  a6 ^cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
, t" f& S% g3 q. ^4 lelse
  j1 h- |' t" R5 E! q/ `cross_marquee.style.left=marqueewidth+8
7 Q, z5 J" T) f+ [. Z( s) V8 i  z( [
}$ s7 i7 S+ i/ n) T3 ^3 c9 |
else if (document.layers){
) d. U4 Y9 A& j4 |if (ns_marquee.left>(actualwidth*(-1)+8))
* t0 b4 A8 C8 S5 T# A6 r, K7 hns_marquee.left-=copyspeed
# j: l/ {1 a, c5 z8 E+ {else# A+ q. g8 L0 ^. g4 ]! |" U$ b
ns_marquee.left=marqueewidth+8% Y4 {" g1 J' I$ R, j" V$ o3 `
}
* U2 h) |' e- L/ S0 R1 i5 ?}
5 U, }, l4 Z0 W8 E
+ T. o4 S" N0 S) X# `; mif (iedom||document.layers){( p. G( b) v4 W! Z% X
with (document){
' c/ Z9 {& y' R+ B' B3 q$ Idocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')) q9 j5 l& X+ h
if (iedom){
3 s) l- C- T& w0 ~# c3 {5 fwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')2 U" p7 ?' I8 M9 T7 K: M0 j+ c' \* n
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
1 r$ \( N$ ]/ Dwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>'). z/ P8 A$ M6 \- e
write('</div>')
6 B+ d: g& c+ i0 H# G2 p}
+ D2 W7 x9 ]$ y) k. U. ]$ `! p% n( aelse if (document.layers){
+ H! _0 a9 G2 G- X4 F7 \( dwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')+ S* A% S4 {, i+ {/ R! c2 Y# q& Y
write('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')
2 A3 C# r9 L) hwrite('</ilayer>')
1 I# C; \2 V, F0 Y) B}, I$ u; D' Z6 ]# t1 h
document.write('</td></table>')/ e# a% c" q$ ^: ]! @) {
}! D: L* n' i$ X$ X. _: Y
}5 _; g5 W# Z, X7 }2 \! b
</script>

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