PHP實現網上點歌(二)

來源:互聯網
上載者:User

midif2.php
<?
$d=dir("./dir"); //得到dir目錄對象
$i="0";
while($entry=$d->read()){
$i=$i+1;
if($i>2){ //大於2的目的是去掉目前的目錄的".",和表示前一個目錄的".."
$wq[]=$entry; //把目錄明細放入$wq數組中
}
}
$d->close(); //關閉
?>
<html>
<head>
<title>List</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script LANGUAGE="javascript">
<!--
var onecount;
onecount=0;
subcat = new Array();
<?
$onecount="0";
for($j=0;$j<count($wq);$j++){
$dir="./dir/".$wq[$j];
$d=dir($dir); //得到每一個dir目錄下的每一個目錄對象
$i="0";
while($entry=$d->read()){
$i=$i+1;
if($i>2){
?>
subcat[<?echo $onecount;?>] = new Array("<?echo $entry;?>","<?echo $wq[$j];?>","<?echo $entry;?>");
<?
$onecount=$onecount+1;
}
}
$d->close();
}
?>
onecount=<?echo $onecount;?>;

function changelocation(locationid)
{
document.myform.song.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.myform.song.options[document.myform.song.length] = new Option(subcat[i][0],subcat[i][2]);
}
}

}
//-->
</script>
</head>
<body>
<form method="post" action="midif1.php" name="myform" target="f1">
<select name="zj" onChange="changelocation(document.myform.zj.options[document.myform.zj.selectedIndex].value)">
<?for($i=0;$i<count($wq);$i++){?>
<option value="<?echo $wq[$i];?>"><?echo $wq[$i];?></option>
<?}?>
</select>
<select name="song">
<option selected value=""></option>
</select>
<input type="submit" name="play" value="播放">
<input type="button" name="stop" value="停止" onclick="javascript:parent.f1.location.href='midif1.php'">
<br>
<br>
播放次數:
<select name="looptime">
<option value="1" selected>只聽一遍</option>
<option value="infinite">百聽不厭</option>
</select>
<a href="javascript:history.go(0)">重新整理曲目</a>
</form>
<script LANGUAGE="javascript">
<!--
changelocation(document.myform.zj.options[document.myform.zj.selectedIndex].value);
//-->
</script>
</body>
</html>

【本文著作權歸作者與奧索網共同擁有,如需轉載,請註明作者及出處】

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.