《JavaSCript 範例》波浪文字
加入網頁步驟
1.將以下的控制碼先複製起來。(用滑鼠將底下的一堆碼,標記起來,按滑鼠右鍵選擇【複製】就行啦!)
2.然後在網頁中的 <BODY> 之後將剛剛複製的東西貼上就大功告成了 !(按滑鼠右鍵選擇【貼上】就行啦!)
3.最後,更改原始碼中的內容就可以了!(就是紅色字的地方,改成您想要的內容即可!)
<body background="jpg/01_bkg1.jpg">
<script language="JavaScript">
//put your text here
var theText = "歡迎光臨頂客論壇";
function nextSize(i,incMethod,textLength)
{
if (incMethod == 1) return (36*Math.abs( Math.sin(i/(textLength/3.14))) );
if (incMethod == 2) return (200*Math.abs( Math.cos(i/(textLength/3.14))));
}
function sizeCycle(text,method,dis)
{
output = "";
for (i = 0; i < text.length; i++)
{
size = parseInt(nextSize(i +dis,method,text.length));
output += "<font style='font-size: "+ size +"pt'>" +text.substring(i,i+1)+ "</font>";
}
theDiv.innerHTML = output;
}
function doWave(n)
{
sizeCycle(theText,1,n);
if (n > theText.length) {n=0}
setTimeout("doWave(" + (n+1) + ")", 100);
}
</script>
<div ID="theDiv" align="center">
</div>