求助,js正则截取字符串
js正则获取varstr="http://player.ku6cdn.com/default/out/pv201106241832.swf?ver=108&vid=S2h...
js正则获取
var str="http://player.ku6cdn.com/default/out/pv201106241832.swf?ver=108&vid=S2h2xc2pEwqoVjb2";
获取vid后面的S2h2xc2pEwqoVjb2,在线等! 展开
var str="http://player.ku6cdn.com/default/out/pv201106241832.swf?ver=108&vid=S2h2xc2pEwqoVjb2";
获取vid后面的S2h2xc2pEwqoVjb2,在线等! 展开
2个回答
展开全部
修改了一下下面的那个方法 ,你看看这样行不行啊:
<script language="javascript">
function t(){
var str="http://player.ku6cdn.com/default/out/pv201106241832.swf?ver=108&vid=S2h2xc2pEwqoVjb2";
alert(str = str.substr(str.indexOf("vid=")+4 ,str.length-str.indexOf("vid=")))
}
</script>
另外的一种方式:
<script>
var url="http://www.asiafxsol.com/register/demoAccountOk.aspx?PromotionCode=1521160&InitialAccountBalance=50000&U=u1632270&P=S2h2xc2pEwqoVjb2"
ut= url.split("&U=")[1].split("&P=")
u=ut[0]
p=ut[1]
alert(u+"\n"+p)
</script>
<script language="javascript">
function t(){
var str="http://player.ku6cdn.com/default/out/pv201106241832.swf?ver=108&vid=S2h2xc2pEwqoVjb2";
alert(str = str.substr(str.indexOf("vid=")+4 ,str.length-str.indexOf("vid=")))
}
</script>
另外的一种方式:
<script>
var url="http://www.asiafxsol.com/register/demoAccountOk.aspx?PromotionCode=1521160&InitialAccountBalance=50000&U=u1632270&P=S2h2xc2pEwqoVjb2"
ut= url.split("&U=")[1].split("&P=")
u=ut[0]
p=ut[1]
alert(u+"\n"+p)
</script>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询