PHP实现网上点歌(二)
程序员文章站
2022-12-26 09:51:18
midif2.php $d=dir("./dir"); //得到dir目录对象 $...
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>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
<?
$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>
【本文版权归作者与奥索网共同拥有,如需转载,请注明作者及出处】
上一篇: 揭秘:南北朝对立取决于北*权吗?
下一篇: 缓存服务器的建立原理分析第1/2页