首先,用javascript肯定不行,因为你要连接后台数据库从数据中导出歌曲数据。以下的是access数据库,数据库中要包含的表及表字段名可以在下面源码中看出来,就当是考考你吧。
每个Checkbox的value=<%rs("id")%>就是等于歌曲的id号,然后传送到newwindow.asp,当点击提交时要用javascript弹出一个对窗口。
具体代码:
1、接收页面(接收checkbox传过来的歌曲id号)newwindow.asp
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <% if request("checked")="" then response.write"<SCRIPT language=JavaScript>alert('您没有选择歌曲!');" response.write"javascript:window.close();</SCRIPT>" else end if %> <html> <head> <style> body{text-align:center; margin:0;} </style> </head> <body> <iframe src="player.asp?id=<%=request("checked")%>" width=700px height=580px scrolling=no cellpadding=0 cellspacing=0 margin=0 frameborder=0></iframe> </body> </html>
2、播放器页面:(player.asp)
<!-- #include file="conn.asp"--> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>player</title> <style type="text/css"> body{text-align:center; margin:0} td{font-size:12px; height:25px; background:#ffffff; margin:0; cellpadding:0; cellspacing:0 } #box{width:100%; border:green 1px solid;} #left{border:blue 1px solid; float:left; width:400px;} #player{border:blue 1px solid;} #plist{border:blue 0px solid; height:300px; text-align:left;} #tblist{width:100%; border:#4682B4 1px solid; background:#4682B4;} </style> </head> <body oncontextmenu="return false" ondragstart="return false" onselectstart="return false"> <div> </div> <div id="box"> <div id="left"> <div id="player"> <object id="mPlayer1" width=395 height=62 classid="CLSID:6BF52A52-394A-11D3-B153-00C04F79FAA6" type=application/x-oleobject standby="Loading Windows Media Player components..."> <param name="URL" value="musiclist.asp?id=<%=request("id")%>"> <param name="rate" value="1"> <param name="balance" value="0"> <param name="currentPosition" value="0"> <param name="defaultFrame" value=""> <param name="playCount" value="100"> <param name="autoStart" value="-1"> <param name="currentMarker" value="0"> <param name="invokeURLs" value="-1"> <param name="baseURL" value=""> <param name="volume" value="100"> <param name="mute" value="0"> <param name="uiMode" value="full"> <param name="stretchToFit" value="0"> <param name="windowlessVideo" value="-1"> <param name="enabled" value="-1"> <param name="enableContextMenu" value="0"> <param name="fullScreen" value="0"> <param name="SAMIStyle" value=""> <param name="SAMILang" value=""> <param name="SAMIFilename" value=""> <param name="captioningID" value=""> <param name="enableErrorDialogs" value="0"> <param name="_cx" value="12435"> <param name="_cy" value="1640"> </object> </div> <!--播放列表--> <div id="plist"> <table id="tblist"> <% if request("id")<>"" then set rs=server.createobject("adodb.recordset") sql="select * from music where id in ("&request("id")&")" rs.open sql,conn,1,3 do while not rs.eof %> <tr> <td width=8%><%=rs("id")%></td> <td wdith=60%><%=rs("songname")%></td> <td width=22%><%=rs("songer")%></td> </tr> <% rs.movenext loop rs.Close set rs=nothing end if conn.close set conn=nothing %> <table> </div> </div> <div id="right"> </div> </div> <div id="bottom"> </div> </body> </html>
3、用asp写ASX文件的页面:musiclist.asp
<!--#include file="conn.asp"--> <ASX version = "3.0"> <% if request("id")<>"" then set rs=server.createobject("adodb.recordset") sql="select * from music where id in ("&request("id")&")" rs.open sql,conn,1,3
do while not rs.eof %> <entry SKIPIFREF="YES"> <title><%=rs("songname")%></title> <ref href="<%=rs("songurl")%>"/> <param name="Artist" value="<%=rs("songer")%>"/> <param name="Title" value="<%=rs("songname")%>"/> </entry> <% rs.movenext loop
rs.Close set rs=nothing end if
conn.close set conn=nothing %> </ASX> |