返回列表 发帖

网页之跑马灯文字特效

//修改宽度  q% Q, {) F* l4 I) Y
var marqueewidth=300
4 }  B& G1 ?- T& J. t- y//高度, M5 e, o' U2 I5 |/ C9 z
var marqueeheight=25. c5 s1 X* D0 a$ g& t
//速度(1-10)
5 `% o% q* k8 C4 }' O! P8 Evar marqueespeed=3
/ R% @2 N5 B8 {. _9 X  R) _# q//背景颜色
+ R5 J: t; t6 e% fvar marqueebgcolor="#FFFFFF"7 U: W/ ]/ _: n
//是否能暂停 (0=no. 1=yes)?
3 _0 r6 _% A2 V% o3 m) g. a+ a2 Avar pauseit=11 q/ Y( t; Y2 M6 G( }# g
& j! j2 u% Q. T& L" n# e
//修改显示内容
' W+ K6 \: A1 j3 K, avar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
; g# {& G0 V$ V8 G$ e( E$ v8 Q
# T) V; n+ |5 e( v) @8 Z7 C
6 ?$ E: l5 ]/ u7 D2 k# V" a) ^////下面不需改变////////////
. M) J4 s; N) C& @) i5 }
$ d4 N4 L2 e1 B. {var copyspeed=marqueespeed' }. ]" }' \' D1 O1 f( j
var pausespeed=(pauseit==0)? copyspeed: 0
; @' y3 K) l) {) b) z* kvar iedom=document.all||document.getElementById8 z& X; c! p  V( u3 C
if (iedom)) H% E: J/ \( T7 b$ J. E: Y! D
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
; b) i% g# ^/ Vvar actualwidth=''
, ?- T) o* F0 Q3 G% s& Dvar cross_marquee, ns_marquee: F0 G" o8 J) H
6 X1 \- O* A9 Y3 K# |7 I
function populate(){
4 y8 ^+ s: Q1 ~0 Uif (iedom){
) o6 E6 F$ s. E- `( {* bcross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
/ Y  V4 X/ @3 @) rcross_marquee.style.left=marqueewidth+8
) q9 }5 c, B& b6 z! x; ^cross_marquee.innerHTML=marqueecontent
( J/ G! {' J3 Yactualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth8 {8 j  I% j( Q8 Y. |, q
}3 C4 Y3 X6 J" s0 L) Y
else if (document.layers){% C# q2 k/ D0 Z: X" m0 ]/ @
ns_marquee=document.ns_marquee.document.ns_marquee2
7 C8 ?: k* C. ?3 l0 d8 ?ns_marquee.left=marqueewidth+8/ C* U6 d% k4 `" k7 m
ns_marquee.document.write(marqueecontent)
9 W9 v& U! S3 ons_marquee.document.close()$ ~# w/ j9 a# [5 ?6 m
actualwidth=ns_marquee.document.width
2 y% n! E. G0 f2 V+ P}8 M; A# f: A/ O
lefttime=setInterval("scrollmarquee()",20)- L1 o! R! u0 i
}' D) s# F0 A! W$ N' J6 L
window.onload=populate
3 n$ v5 l( t' [4 C$ ]
; U6 R" L! K) |# {8 q# u& ^function scrollmarquee(){
, @$ b4 I+ C- k& }# Y0 ?5 R# Aif (iedom){
7 y4 T+ L+ w2 Hif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))6 J% n7 x8 p( S
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed4 v) }) ~, Z. @
else% |0 y+ D4 Y7 ]. X  {- w; q1 Q
cross_marquee.style.left=marqueewidth+8
; Y! Q4 u9 R, z% e  J* D# a& X  q& d1 d
}
7 w9 i4 l& h0 [& h: ^else if (document.layers){
( y# `; G( @* q( pif (ns_marquee.left>(actualwidth*(-1)+8))
" S" z) ]  M) r" F( r* Y% }# uns_marquee.left-=copyspeed% m# K" T% K5 Y5 z6 L4 ~
else4 L7 O0 g- ]8 l" E, @& {, N0 q  V
ns_marquee.left=marqueewidth+8
' W/ c+ G, U, v0 K8 W}* o( R1 M9 @9 W& M
}
: Y7 J' \  W% z. m6 ~6 p# x' \" R4 q! J2 `( K
if (iedom||document.layers){
6 ?- e* g; ~; k+ j5 M6 q: T) H7 ?1 B6 Ywith (document){/ U4 U8 W" x0 y  |1 Q5 M. O# {- B
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')7 O7 S9 S: d; L6 |' Z+ u2 P- z
if (iedom){
7 U0 J9 [* s# Jwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')
! E( z2 K7 Y6 X! vwrite('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
4 u- H* g" E4 ~/ m- z  w, S# n; Vwrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')0 b) Y- B( G9 r$ B7 E) t- Z9 ^
write('</div>')
* T0 o. v! X- l! T/ R) g! E0 ~}
& v+ ~( V# g% L3 I7 ^9 d7 ]' Gelse if (document.layers){" p+ C) z$ o2 k2 U/ l0 y& n
write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
2 h) H8 z5 w( f( K3 g+ ewrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'), d. {4 W( S; R, G9 w* L/ Z
write('</ilayer>')8 [  ]8 ^9 M! d6 b" A
}4 F4 }$ l, J9 u7 V8 Z8 F: {
document.write('</td></table>')4 ?1 d: Y  b# f: p
}9 u, ]7 x: b: T
}
0 ]4 e9 V7 ^3 t$ M9 W  y8 z. Q5 \</script>

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