[轉貼]Circle Ticker圓盤字串

有關網頁及相關語法的討論
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

[轉貼]Circle Ticker圓盤字串

文章 tim »

轉貼自:
http://webdeveloper.earthweb.com/webjs/ ... php/287171

很不錯的效果, 而且和中文完全相容!


Circle Ticker
Submitted: 10/23/2003
By: Peter Gehrig

Circle ticker draws your messages around a circle in the center of your webpage. Impressive shade and fade effect. Easy configuration of messages, colors, size. Add as many messages as you like.

•System Requirements: Internet Explorer 5x/6x or higher.
•License: freeware
•Language: javascript

代碼: 選擇全部

<html>

<head>

<title>Circle Ticker</title>

<meta NAME="keywords" CONTENT="DHTML, javascript, VML, scroller, ticker, marquee, fade, marquee, download, free, script, applet">

<meta NAME="description" CONTENT="Circle ticker draws your messages around a circle in the center of your webpage. Add as many many messages as you like. Requires Internet Explorer 5x or higher.">

<xml:namespace ns="urn:schemas-microsoft-com:vml" prefix="v"/>
<style>
v:* { behavior: url(#default#VML); }
</style>

</head>

<body>

<form>
<table width=540 cellpadding=0 cellspacing=0 border=0><tr><td>
<font size=2 face=Verdana><font size=2 face=Verdana color=red><b>Circle Ticker</b></font>
Circle ticker draws your messages around a circle in the center of your webpage. Add as many many messages as you like. Requires Internet Explorer 5x/6x or higher.




<!-- Credits Author of the script is Peter Gehrig founder of the javascript Site <a href=http://www.24fun.com target=_blank>www.24fun.com</a> -->







<script>
// Circle Ticker 
// By Peter Gehrig
// Copyright (c) 2003 Peter Gehrig. All rights reserved.
// Permission given to use the script provided that this notice remains as is.
// Additional scripts can be found at <a href=http://www.24fun.com target=_blank>http://www.24fun.com</a>
// <A HREF=mailto:[email protected]>[email protected]</A>
// 10/21/2003

// IMPORTANT:
// If you add this script to a script-library or script-archive
// you have to add a highly visible link to
// <a href=http://www.24fun.com target=_blank>http://www.24fun.com</a> on the webpage
// where this script will be featured

// CONFIGURATION:
// Go to <a href=http://www.24fun.com target=_blank>http://www.24fun.com</a>
// and create more text animation
// with our new Text Factory.

// Add as many messages as you like
var message=new Array("Hi Webdesigner", "Download our free scripts", "Surprise your visitors with smashing effects", "Bring more excitement to your webpages", "Have fun and try to be happy")

// Set the outline-color. Add as many colors as you like
var outlinecolor=new Array("white", "black")

// Set fillcolors 1. Add as many colors as you like
var fillcolor1=new Array("blue", "green", "white", "green")

// Set fillcolors 2. Add as many colors as you like
var fillcolor2=new Array("yellow", "olive", "black", "black")

// Set the letter marking the circle
var circlemark=new Array("-")

// Set the width of the outline
var strkweight=2

// Set the waiting time between the messages (seconds)
var pause=2

// Set the strength of the opacity (transparency of letters)
var strengthopacity="60%"

// Set the size of the circle (values range from 0.1 to 1)
var circlesize=0.6

// Do not edit below this line
var outerwidth=document.body.clientWidth
var outerheight=document.body.clientHeight

var innerwidth=Math.floor(circlesize*outerwidth)
var innerheight=Math.floor(circlesize*outerheight)

var posleft=(outerwidth-innerwidth)/2
var postop=(outerheight-innerheight)/2+50

var path=new Array()
var i_message=0
var i_outlinecolor=0
var i_fillcolor1=0
var i_fillcolor2=0
var i_messagelength=0
var longestmessage=0
pause*=1000

var ie=document.getElementById&&document.all?1:0 

for (i=0;i<=message.length-1;i++) {
if (message[i].length>longestmessage) {
longestmessage=message[i].length
}
longestmessage+=4
}

for (i=0;i<=message.length-1;i++) {
var emptyspace=""
var i_emptyspace=(longestmessage-message[i].length)/2
for (ii=0;ii<=i_emptyspace;ii++) {
emptyspace+=circlemark
}
message[i]=emptyspace+" "+message[i]+" "+emptyspace
}

function changeform() {
if (i_outlinecolor >= outlinecolor.length) {i_outlinecolor=0}
if (i_fillcolor1 >= fillcolor1.length) {i_fillcolor1=0}
if (i_fillcolor2 >= fillcolor2.length) {i_fillcolor2=0}
document.getElementById('strokeid').color=outlinecolor[i_outlinecolor]
document.getElementById('fillid').color=fillcolor1[i_fillcolor1]
document.getElementById('fillid').color2=fillcolor2[i_fillcolor2]
if (i_message < message.length) {tick()}
else {document.getElementById('textpathid').string=""}
}

function tick() {
if (i_messagelength <= message[i_message].length) {
var messagestringend=""
var messagestring=message[i_message].substring(0, i_messagelength)+messagestringend
document.getElementById('textpathid').string=messagestring
var timer=setTimeout("tick()",50)
i_messagelength++
}
else {
clearTimeout(timer)
i_messagelength=0
i_message++
i_outlinecolor++
i_fillcolor1++
i_fillcolor2++
var timer=setTimeout("changeform()",pause)
}

}

if (ie) {
document.write('<div id="roofid" style="position:absolute;left:0px;top:0px;width:'+outerwidth+'px;height:'+outerheight+'px;overflow:hidden;">')
document.write('<v:oval id="tc" style="position:absolute;top:'+postop+';left:'+posleft+';width:'+innerwidth+';height:'+innerheight+'">')
document.write('<v:shadow on="t" opacity="'+strengthopacity+'"/>')
document.write('<v:stroke id="strokeid" weight="'+strkweight+'pt" color="blue"/>')
document.write('<v:fill id="fillid" on="True" color="'+fillcolor1[0]+'" color2="'+fillcolor2[0]+'" opacity="'+strengthopacity+'" opacity2="'+strengthopacity+'" type="gradient"/>')
document.write('<v:path textpathok="t"/>')
document.write('<v:textpath id="textpathid" on="t" id="mytp" style="font-family:'Arial Black'; " fitpath="t" string=""/>')
document.write('</v:oval>')
window.onload=changeform
}
</script>

</body>
</html>

多多留言, 整理文章, 把經驗累積下來.....
回覆文章