|
蓝森林 http://www.lslnet.com 2006年8月25日 8:28
[请教]音乐波表能制作么
[html]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>
<script language="javascript">
var N=30;
var ledList=new Array(1,2,3,4,5,6,5,4,3,2);
var ColorList=new Array("","005500","006600","007700","008800","009900","00AA00","00BB00","00CC00","00DD00","00EE00","00FF00");//,"A","B","C","D","E","F");
var ledid=0;
function CreatTable()
{
var i,j,HtmlCode,tdw,tblw,thisColor;
tdw=15;
tblw=tdw*N;
if(ledid==0) ledid+=N;
chgled();
HtmlCode="<table width=\""+tblw+"\" border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n";
for(i=N;i>0;i--)
{
HtmlCode+="\t<tr>";
for(j=1;j<=N;j++)
{
thisColor="";
tempvalue="";
//if(i==ledList[j]+1) tempvalue=ledList[j];
if(i<=ledList[j])
thisColor="bgcolor=\""+GetColor(i)+"\"";
HtmlCode+="\n\t<td "+thisColor+" width=\""+tdw+"\" height=\""+tdw+"\">"+tempvalue+"</td>\t";//"+ledList[(ledid+j)%N]+"
}
HtmlCode+="</tr>\n";
}
HtmlCode+="</table>";
document.all("main").innerHTML=HtmlCode;
// alert(HtmlCode);
ledid--;
doit = setTimeout("CreatTable();",500);
}
function chgled()
{
NewNode=Math.round(Math.random()*(N-1));
for(i=ledList.length;i>0;i--)
{
ledList[i]=ledList[i-1];
}
ledList[0]=NewNode;
// alert(ledList);
}
/*function chgled()
{
NewNode=ledList[N];
if(NewNode<0) NewNode=N-NewNode;
for(i=ledList.length;i>0;i--)
ledList[i]=ledList[i-1];
ledList[0]=NewNode;
}//*/
function GetColor(id)
{
var i,NewColor;
NewColor="#";
NewColor+=(ColorList[id]);//*/
return NewColor;
}
function stopLed()
{
clearTimeout(doit);
}
</script>
<body onLoad="CreatTable()">
<label id="main"></label>
<input type="button" onClick="stopLed()" value="停止">
<input type="button" onClick="CreatTable()" value="继续">
</body>
</html>
[/html]
希望实现能读取音乐文件,并按照节奏改变显示。上面的程序是我无聊的时候写的,然后就想到了这个想法,不知道能不能实现,感觉似乎不行的说,不知道各位有什么高见,谢谢.:) |
你的代码一跑就快死机了-_-
js要实现你这个想法很难,后台程序也很难。。。 |
Sheneyan该换机子了:)
不要动态地改变HTML,这样太耗费资源。你可参考
http://bbs.blueidea.com/viewthread.php?tid=1806490
[耍宝的小玩意儿]
改变固定元素的属性即可,在你这个case里就是改变格子的颜色。
|
|