写的音乐试听列表代码-1.asp 如下:
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<!--#include file=conn.asp-->
<%
dim rs
sql="select id,wma,musicname,singer,hits from musiclist where id="&cstr("id")
set rs=server.CreateObject("adodb.recordset")
rs.open sql,conn,1,1
if rs.eof then
response.Write"<script>alert('未收录歌曲。');window.location.href='index.asp';</script>"
else
%>
<table width="100%" border="0" style="BORDER-TOP : #000000 1px solid; BORDER-LEFT: #000000 1px solid; BORDER-RIGHT: #000000 1px solid " >
<tr>
<td width="7%" align="center" valign="middle" backround= "../图片/ll.gif"><font size="2" face="宋体">选择</font></td>
<td width="42%" background="../图片/ll.gif" ><font size="2" face="宋体">歌曲</font></td>
<td width="29%" background="../图片/ll.gif" ><font size="2" face="宋体">歌手</font></td>
<td width="22%" background="../图片/ll.gif" ><font size="2" face="宋体">试听</font></td>
</tr>
<%
i=0
do while not rs.eof
i=i+1
%>
<tr>
<td align="right" valign="middle" bgColor=#e7e3e7><font size="2" face="宋体"><%=rs("id")%></font>.</td>
<td style="BORDER-RIGHT : #000000 1px solid ;BORDER-TOP : #000000 1px solid"><a href="#"><font color="#000000" size="2" face="宋体" STYLE="Text-Decoration:none"><%=rs("musicname")%></font></a></td>
<td style="BORDER-RIGHT : #000000 1px solid ;BORDER-TOP : #000000 1px solid"><a href="#"><font color="#000000" size="2" face="宋体" STYLE="Text-Decoration:none"><%=rs("singer")%></font></a></td>
<td style="BORDER-ROGHT : #000000 1px solid;BORDER-TOP : #000000 1px solid">
<%if rs("wma")<>"" then%>
<a href="#" onclick="MM_openBrWindow('paly1.asp?id=<%=rs("id")%>')"><img src="image/21.gif" width="33" height="13" border="0"></a>
<%else
response.Write"<script>alert('未收录歌曲。');window.location.href='reg1.asp';</script>"
end if%></td>
</tr>
<%
rs.movenext
loop
end if
rs.close
%>
</table>
运行正常
点试听后转跳到play1.asp
<!--#include file=conn.asp-->
<%
if request("id")<>"" then
set rs=server.CreateObject("adodb.recordset")
id=request("id")
sql="select * from musiclist where id="&id
rs.open sql,conn,1,3
if rs.eof then
errmsg="<li>对不起!该歌曲不存在,可能已经被管理员删除。</li>"
call error()
response.End
else
rs("hits")=rs("hits")+1
rs.update
id=rs("id")
wma=rs("wma")
hits=rs("hits")
singer=rs("singer")
musicname=rs("musicname")
end if
rs.close
else
errmsg="<li>请选择歌曲!</li>"
call error()
response.end
end if
set rs=nothing
conn.close
set conn=nothing
sub error()
errmsg="<li>对不起!</li>"
end sub
url="http://"&request.ServerVariables("SERVER_NAME")&finddir(request.ServerVariables("PATH_INFO"))&"song"&rs(wma) (这是第36行)
%>
<div align="center">
<object classid="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6" width=288 height=69 id="mPlayer1">
<param name="URL" value="<%=url%>">
<param name="rate" value="1">
<param name="blance" value="0">
<param name="currentposition" value ="0">
<param name="defaultframe" value ="">
<param name="palycount" value ="100">
<param name="autostart" value ="-1">
<param name="invokeurls" value ="-1">
<param name="baseurl" value ="-1">
<param name="volume" value ="50">
<param name="mute" value ="0">
<param name="uimode" value ="full">
<param name="stretchtofit" value ="0">
<param name="winowlessvideo" value ="0">
<param name="enabled" value ="-1">
<param name="enabledcontextmenu" value ="0">
<param name="enabled" value ="-1">
<param name="fullscreen" value ="0">
<param name="samistyle" value ="">
<param name="samilang" value ="">
<param name="samifiename" value ="">
<param name="captioningid" value ="">
</object>
</div>
<%
function finddir(filepath)
for i=1 to len(filepath)
if left(right(filepath,i),1)="/" or left(right(filepth,i),1)="\" then
abc=i
exit for
end if
next
if abc <> 1 then
finddir=left(filepath,len(filepath)-abc+1)
end if
end function
%>
报错:
Microsoft VBScript 运行时错误 (0x800A000D)
类型不匹配: 'rs'
/paly1.asp, 第 36 行
单独运行paly1.asp不报错