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

|
网页之跑马灯文字特效
//修改宽度6 ?& L. _. }8 S5 m. q
var marqueewidth=300
7 ?3 ~& n6 |+ i9 h8 ~# r//高度) w; O! M v" K5 i& Z. W
var marqueeheight=25
; C/ l3 z1 W) ^//速度(1-10)% o, Y7 x ^+ }' U. o) l
var marqueespeed=3
5 K( X' ~& u2 p" ^, ~8 N- `//背景颜色
& h+ }/ b* T, E; Fvar marqueebgcolor="#FFFFFF"
2 {6 J1 `4 o' v' r- E//是否能暂停 (0=no. 1=yes)?% d9 Z" J5 S: e1 G* o; b
var pauseit=1' _: q' ?2 i+ t, B
2 o. }* u1 U/ `' x% v
//修改显示内容
0 c" C P3 p* Y8 ovar marqueecontent='<nobr><font face="Arial" size=2><a href="http://www.jzzy.com/js.asp">欢迎光临七色风网页家园</a>--这里有从上千个网页特效中精选的300多个实用的特效,另外,为了网友更方便地学习,我们还改写和编写了部分的特效,并作了详细的说明和必要的使用提示!</font></nobr>'* b2 h% V" [* ~9 ?, @& Q* E6 u
, X' c' a* X0 N7 N
+ R' |- F9 M1 m3 m% g3 a# q////下面不需改变////////////* e* R ]6 n* M! F
/ Y; f2 O5 S1 O4 ^var copyspeed=marqueespeed) J, ^0 k+ J0 L+ A3 M
var pausespeed=(pauseit==0)? copyspeed: 0
1 @7 l( e2 W4 ^9 k# ?; Jvar iedom=document.all||document.getElementById
7 w* j9 B9 _& J a: Rif (iedom)! E9 k5 B8 L9 ~, L Y# @/ Y/ I K+ ?
document.write('<span id="temp" style="visibility:hidden;position:absolute;top:-100;left:-1000">'+marqueecontent+'</span>')
0 @1 X8 o8 \ Uvar actualwidth=''0 V+ }' O# O$ ~8 C& }+ _
var cross_marquee, ns_marquee4 ~6 ]4 J0 f; h$ x$ |5 P% ?* C# G
& G E0 L5 L, N7 |
function populate(){+ E8 d7 I K/ ]. c% X/ b
if (iedom){ o5 T- \" N9 Y5 c
cross_marquee=document.getElementById? document.getElementById("iemarquee") : document.all.iemarquee
$ j5 i7 E5 Q6 r4 m/ a' Xcross_marquee.style.left=marqueewidth+86 u: t K# v0 ]
cross_marquee.innerHTML=marqueecontent7 n" }2 d# `1 B1 U4 f
actualwidth=document.all? cross_marquee.offsetWidth : document.getElementById("temp").offsetWidth* d$ J9 F. ]$ @$ F
}
@ w: F- R Nelse if (document.layers){
8 k! s8 w8 t a8 m* G! pns_marquee=document.ns_marquee.document.ns_marquee2
+ Q! D* h6 ~& Y* S) |$ h) gns_marquee.left=marqueewidth+8, Z- P1 q' g" \. T7 k' Z
ns_marquee.document.write(marqueecontent)) M, Z! w1 f: |* S( b! H5 M7 p, T
ns_marquee.document.close()! D1 r, c* O1 X, P6 [* z4 E
actualwidth=ns_marquee.document.width. U7 Y. ?, G& Y) o. ?
}0 y) N, r" ]8 q5 n0 ?+ b* Z
lefttime=setInterval("scrollmarquee()",20)6 G5 m* P, J, N
}9 ^7 }+ o" d7 m& _9 J$ ~
window.onload=populate9 p+ R# A" E* I2 [' r( x0 @5 w
! T+ b9 m% {4 c. }3 `2 bfunction scrollmarquee(){
$ L1 [) V( J( e$ [/ q% v+ @" Bif (iedom){! G$ a; K' s! g! ~
if (parseInt(cross_marquee.style.left)>(actualwidth*(-1)+8))8 J( e3 w5 C4 O& n( Y' I7 ~7 ~9 `
cross_marquee.style.left=parseInt(cross_marquee.style.left)-copyspeed
$ m$ L% J6 Y$ Nelse
' `9 g2 J7 r6 o5 @* Bcross_marquee.style.left=marqueewidth+8
0 u9 _8 G( e) F# o* H& o
/ |6 e& K8 t" w3 O: @) P}
7 | r# u1 k: b5 J: C1 l8 R, \else if (document.layers){
% \- t( e. b- ~! }8 nif (ns_marquee.left>(actualwidth*(-1)+8))* u# f3 f+ M: p+ F. s. P0 Y4 {
ns_marquee.left-=copyspeed
( s' s( M0 x4 k3 relse. |) b5 \( S9 F" h4 m2 H/ u6 U
ns_marquee.left=marqueewidth+8# L' F( l3 ~# j5 ?! I
}
* J4 g0 _$ z) b- g}) E% p/ |% q( y5 F; p7 j: v
+ w" s7 e( l7 g6 V% W) w+ n2 ^
if (iedom||document.layers){
9 G; t4 S5 P4 bwith (document){# w0 |/ {* ~+ Z1 X' u! M# X
document.write('<table border="0" cellspacing="0" cellpadding="0"><td>')
# R! s3 V" F6 E8 ^- Y4 b2 Q, y6 y- Zif (iedom){
/ f% x1 v) y7 i! wwrite('<div style="position:relative;width:'+marqueewidth+';height:'+marqueeheight+';overflow:hidden">')8 P, _, Y, H% R6 C. |6 O. N7 \
write('<div style="position:absolute;width:'+marqueewidth+';height:'+marqueeheight+';background-color:'+marqueebgcolor+'" onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed">')0 m {: @: a: ]0 [$ s. t2 p
write('<div id="iemarquee" style="position:absolute;left:0;top:0"></div>')6 l* `/ k6 h! O6 ^. g8 m2 [& z
write('</div>')* j2 y( }5 M' ]; E/ ]2 y
}
( i6 V+ Q% ^: G. g& E# @5 Nelse if (document.layers){
9 V Y! p6 @. K7 c# Bwrite('<ilayer width='+marqueewidth+' height='+marqueeheight+' name="ns_marquee" bgColor='+marqueebgcolor+'>')
4 c* i. @0 w' w8 P: F! A/ F7 }6 pwrite('<layer name="ns_marquee2" left=0 top=0 onMouseover="copyspeed=pausespeed" onMouseout="copyspeed=marqueespeed"></layer>'). V I8 P9 a0 T, M- L% |
write('</ilayer>')
% v1 A0 `/ o( \. V/ [# ~}
! T& F( a& j. P# v; \, T; [document.write('</td></table>')
1 Z, W9 G2 D8 Z6 U2 C* h' b}9 b( S8 V) g' _
}* a' }# ~4 I5 M1 _
</script> |
|