PHP實(shí)現(xiàn)網(wǎng)上點(diǎn)歌(二)
更新時(shí)間:2006年10月09日 00:00:00 作者:
midif2.php
<?
$d=dir("./dir"); //得到dir目錄對(duì)象
$i="0";
while($entry=$d->read()){
$i=$i+1;
if($i>2){ //大于2的目的是去掉當(dāng)前目錄的".",和表示前一個(gè)目錄的".."
$wq[]=$entry; //把目錄明細(xì)放入$wq數(shù)組中
}
}
$d->close(); //關(guān)閉
?>
<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); //得到每一個(gè)dir目錄下的每一個(gè)目錄對(duì)象
$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>
播放次數(shù):
<select name="looptime">
<option value="1" selected>只聽(tīng)一遍</option>
<option value="infinite">百聽(tīng)不厭</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>
【本文版權(quán)歸作者與奧索網(wǎng)共同擁有,如需轉(zhuǎn)載,請(qǐng)注明作者及出處】
<?
$d=dir("./dir"); //得到dir目錄對(duì)象
$i="0";
while($entry=$d->read()){
$i=$i+1;
if($i>2){ //大于2的目的是去掉當(dāng)前目錄的".",和表示前一個(gè)目錄的".."
$wq[]=$entry; //把目錄明細(xì)放入$wq數(shù)組中
}
}
$d->close(); //關(guān)閉
?>
<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); //得到每一個(gè)dir目錄下的每一個(gè)目錄對(duì)象
$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>
播放次數(shù):
<select name="looptime">
<option value="1" selected>只聽(tīng)一遍</option>
<option value="infinite">百聽(tīng)不厭</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>
【本文版權(quán)歸作者與奧索網(wǎng)共同擁有,如需轉(zhuǎn)載,請(qǐng)注明作者及出處】
您可能感興趣的文章:
- php獲取從百度、谷歌等搜索引擎進(jìn)入網(wǎng)站關(guān)鍵詞的方法
- php實(shí)現(xiàn)搜索一維數(shù)組元素并刪除二維數(shù)組對(duì)應(yīng)元素的方法
- PHP查找與搜索數(shù)組元素方法總結(jié)
- php 批量查詢(xún)搜狗sogou代碼分享
- php站內(nèi)搜索關(guān)鍵詞變亮的實(shí)現(xiàn)方法
- php啟用sphinx全文搜索的實(shí)現(xiàn)方法
- 將酷狗krc歌詞解析并轉(zhuǎn)換為lrc歌詞php源碼
- 谷歌音樂(lè)搜索欄的提示功能php修正代碼
- PHP實(shí)現(xiàn)簡(jiǎn)單搜歌的方法
相關(guān)文章
PHP的mysqli_rollback()函數(shù)講解
今天小編就為大家分享一篇關(guān)于PHP的mysqli_rollback()函數(shù)講解,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧2019-01-01php checkbox復(fù)選框值的獲取與checkbox默認(rèn)值輸出方法
php獲取 checkbox復(fù)選框值的方法,checkbox在php讀取值時(shí)要用數(shù)組形式哦,我們讀取這些值用php post獲取是以一個(gè)array形式哦。2010-05-05php in_array 函數(shù)使用說(shuō)明與in_array需要注意的地方說(shuō)明
in_array函數(shù)用功能就是檢查是否存在一個(gè)值的數(shù)組 ,就是判斷當(dāng)前數(shù)組中是否存在一個(gè)指定的值哦。2010-04-04PHP_MySQL教程-第二天while循環(huán)與數(shù)據(jù)庫(kù)操作
PHP_MySQL教程-第二天while循環(huán)與數(shù)據(jù)庫(kù)操作...2007-03-03php數(shù)據(jù)庫(kù)連接時(shí)容易出錯(cuò)的特殊符號(hào)問(wèn)題
在利用php來(lái)操作數(shù)據(jù)庫(kù)的時(shí)候,倘若有添加,修改等操作時(shí),需要注意的特殊字符。2010-09-09