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

|
网页之跑马灯文字特效
//修改宽度
. X1 n$ e1 v" yvar marqueewidth=300 F, Z7 l; P( M- O5 l' f0 g( C
//高度
# V! X# S) C6 @% o3 K+ U/ gvar marqueeheight=25
1 p; W9 F. e: x6 z) F//速度(1-10); T/ B, }8 B/ l2 z& w
var marqueespeed=3% N/ C3 l y; b* X1 Y
//背景颜色$ n- C% R: y, ^ E/ u8 c2 t# [" r
var marqueebgcolor="#FFFFFF"
7 s* M7 q4 U6 g$ B; }4 S//是否能暂停 (0=no. 1=yes)?
6 {/ c9 i# Y3 k e) R2 K0 mvar pauseit=19 h5 C# c/ v. T/ F/ q
. c* G' ?# ?' l2 S0 f+ [; q( m//修改显示内容
: v5 B L! y, B# {& Mvar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'
0 a3 J0 v& n! X) z; E
4 }$ x b) m. T9 S* v0 `7 H O; o0 z6 J, g
////下面不需改变////////////# j: v% t' x& A3 m
4 K" X$ O& N) o; k3 }4 X; m
var copyspeed=marqueespeed
0 M+ C4 W3 J3 Q9 Jvar pausespeed=(pauseit==0)? copyspeed: 0& l" k; B- v$ P( v% H* x
var iedom=document.all||document.getElementById
+ t: Q$ B1 ^; m* j8 H& B+ a) Oif (iedom)/ c/ c$ E7 ~2 ^0 o0 Z& S
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
- A1 ?# z5 q! u( @4 |$ ?0 E/ r8 Fvar actualwidth=''- _& A. |! }7 y
var cross_marquee, ns_marquee
- |8 K3 C$ f7 K2 R5 P9 Q( f k! ~+ W U# E) Z1 S" U$ w& L2 a
function populate(){# G' ~1 \" m$ U4 A% y
if (iedom){5 L0 i, I0 U* a) C
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
& X. a9 t& Z$ e' a$ P( Q; Ocross_marquee.style.left=marqueewidth+83 b2 O& N8 p1 k I& q
cross_marquee.innerHTML=marqueecontent- \" r* `! Z* u8 U' R+ `
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth
* ~$ U; e5 z% h/ S- _% X9 r}7 T! s$ h4 H# t6 |3 A- I& R
else if (document.layers){! [1 O9 R4 r% r
ns_marquee=document.ns_marquee.document.ns_marquee2
# U" ?7 i- C+ Y5 j( V: u) Uns_marquee.left=marqueewidth+8$ @7 i; g9 {3 S$ s. _, e2 T
ns_marquee.document.write(marqueecontent)
. v M& h; z$ y" \! Sns_marquee.document.close()& R/ n, I5 J* W. u
actualwidth=ns_marquee.document.width
8 p3 N; d5 s8 d! c; O& U}: r2 g6 `* u" N
lefttime=setInterval("scrollmarquee()",20)
7 \" j4 F& w {" E}; }) w4 V8 z c5 ?+ @
window.onload=populate
' B1 L& \ R! V! [" I3 D' X5 C7 L. `" K% D; b
function scrollmarquee(){
# p9 u5 { i4 R7 kif (iedom){
R; [. c$ X) U" S! s5 Rif (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))5 Y o6 p/ c5 Y$ Q) v4 D7 F
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed7 J6 [4 q/ x t
else
' K6 m o5 }$ Z* W9 o/ M- `, ecross_marquee.style.left=marqueewidth+8/ N' G7 P+ ~! ]- Y
4 i4 K! N! d- F/ v3 h' D5 P}+ r! D2 H" Q! W# a+ n: \- A
else if (document.layers){- L9 |4 }* ?1 I4 g7 A& {
if (ns_marquee.left>(actualwidth*(-1)+8))( B& e4 }; `' X$ g( d" {! ?( V
ns_marquee.left-=copyspeed
) g8 X$ h/ Z1 p& uelse3 H# S, O: A) f: x; c- D( F9 k
ns_marquee.left=marqueewidth+8
7 E. Z5 Z: O' }1 [, O}" v0 V* D) y+ O1 A8 ]/ Z8 s: F
}5 z5 ^& Y. E" m; U9 B. o; K4 U
8 u) L( g0 y4 M& |2 q, Y
if (iedom||document.layers){& [% p* d3 f4 j$ g; r( C" R6 ^
with (document){
% o9 ]- b2 w; s/ f8 Ldocument.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
+ ^1 @+ m9 S4 X! F' v! kif (iedom){
* E4 D3 s. o0 k% Q: r" Vwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')3 C; B7 `/ D }4 c' c1 z% C! V" ~
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')
G/ v6 p0 H8 J! k& \# z1 ewrite('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')
: H: v; p: w( i2 L3 s% I: L' Xwrite('</div>')
! l+ G+ L0 I& O, c) E' q" J1 Y/ L}
# y1 S+ `1 E8 u2 a+ ^3 a# w* relse if (document.layers){
. p' Q# o5 b# y6 J3 ~write('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
& P+ u7 Y: [) s* Ywrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>')) ?' N$ ]# q+ X
write('</ilayer>')
9 I. x1 z9 m5 z5 k+ ^( g}8 u4 R% x# k9 c& x( t
document.write('</td></table>')1 q" r1 I; J- A; L4 h
}3 Y% H6 d9 H6 N8 q
}" [+ l2 ]9 f% V! F
</script> |
|