asp程序 js怎样限制添加的歌曲地址 后缀名为mp3? 帮忙改下谢谢
endifrs.addnewiftrim(request.form("musicname"))=""thenresponse.write"<scriptlanguage=...
end if
rs.addnew
if trim(request.form("musicname"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写名称');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
if trim(request.form("file"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
rs("musicname")=trim(request("musicname"))
rs("singer")=trim(request("singer"))
rs("file")=trim(request("file"))
rs("username")=trim(request("user"))
rs.update
rs.close
response.write "<script language=javascript>"
response.write "alert('添加成功!继续添加?');"
response.write "</script>"
response.write "<script language=javascript>location='?user="&user&"'</script>"
Response.End
不好意思 发的时候没注意
vbs???
下面朋友给我的我融合不了
end if
if trim(request.form("file"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写地址以.MP3为结尾的歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
这段怎么改??? 添加的歌曲地址 后缀名一定要为mp3? 其他格式不可以加..
加错的话,....在提交之后弹出提示 展开
rs.addnew
if trim(request.form("musicname"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写名称');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
if trim(request.form("file"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
end if
rs("musicname")=trim(request("musicname"))
rs("singer")=trim(request("singer"))
rs("file")=trim(request("file"))
rs("username")=trim(request("user"))
rs.update
rs.close
response.write "<script language=javascript>"
response.write "alert('添加成功!继续添加?');"
response.write "</script>"
response.write "<script language=javascript>location='?user="&user&"'</script>"
Response.End
不好意思 发的时候没注意
vbs???
下面朋友给我的我融合不了
end if
if trim(request.form("file"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写地址以.MP3为结尾的歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
这段怎么改??? 添加的歌曲地址 后缀名一定要为mp3? 其他格式不可以加..
加错的话,....在提交之后弹出提示 展开
5个回答
展开全部
将你给的代码:
if trim(request.form("file"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写地址以.MP3为结尾的歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
改成如下代码:
Dim music
music = split(request.form("file"),".")
if LCase(music(ubound(music)))<>"mp3" then '判断后缀是否为mp3
response.write "<script language=javascript>"
response.write "alert('请填写地址以.MP3为结尾的歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
本地调试通过
if trim(request.form("file"))="" then
response.write "<script language=javascript>"
response.write "alert('请填写地址以.MP3为结尾的歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
改成如下代码:
Dim music
music = split(request.form("file"),".")
if LCase(music(ubound(music)))<>"mp3" then '判断后缀是否为mp3
response.write "<script language=javascript>"
response.write "alert('请填写地址以.MP3为结尾的歌曲地址');"
response.write "</script>"
response.write "<script language=javascript>location='javascript:history.back(1)'</script>"
Response.End
本地调试通过
展开全部
<script>
var url="c:\dd.mp3"
if(url.lastIndexOf(".mp3")==4||url.lastIndexOf(".MP3")==4){
alert("成功!")
}else{
alert("失败!")
}
</script>
//补充
url="<%=request.form("file")%>"就可以了啊
var url="c:\dd.mp3"
if(url.lastIndexOf(".mp3")==4||url.lastIndexOf(".MP3")==4){
alert("成功!")
}else{
alert("失败!")
}
</script>
//补充
url="<%=request.form("file")%>"就可以了啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
据我了解·
你说的那样是不可能的··
如有疑问请点此处.
https://gss0.baidu.com/7LsWdDW5_xN3otqbppnN2DJv/328070956/pic/item/8b4908edb4382f5b79f05547.jpg
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不好意思 发的时候没注意
js怎样判断添加的歌曲地址
后缀名一定要为mp3?
在提交之后弹出提示
否则不于添加
帮忙改下谢谢
js怎样判断添加的歌曲地址
后缀名一定要为mp3?
在提交之后弹出提示
否则不于添加
帮忙改下谢谢
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你是说在提次之前还是在提交之后再验证?你自己都不描述清楚?别人怎么么帮你啊?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询