JavaScript获取url后缀

Gaulhor Alex 2010-05-25 07:21:43
我现在又url
http://www.xxx.com/aaa.html?dne=hiejs&jco=snncl
http://www.xxx.com/aaa.do?dne=hiejs&jco=snncl
http://www.xxx.com/aaa.action?dne=hiejs&jco=snncl

请问怎么去的url的后缀
html do action
...全文
195 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
mingfish 2010-05-25
  • 打赏
  • 举报
回复
hookee哥,帮忙看看我的问题,

	function div_hover(){
$("div").hover(
function(e){
$(this).addClass("hover");
event.cancelBubble=true;
},
function(e){
$(this).removeClass("hover");
event.cancelBubble=true;
}
);
}


function div_hover(){
$("div").hover(
function(e){
e.stopPropagation();
$(this).addClass("hover");
},
function(e){
e.stopPropagation();
$(this).removeClass("hover");
}
);
}
都不行



jquery hover事件如何不冒泡?
hookee 2010-05-25
  • 打赏
  • 举报
回复

s = "http://www.xxx.com/aaa.html?dne=hiejs&jco=snncl";
alert(doit(s));
s = "http://www.xxx.com/aaa.do?dne=hiejs&jco=snncl";
alert(doit(s));
s = "http://www.xxx.com/xx/123.aaa.action?dne=hiejs&jco=snncl";
alert(doit(s));

function doit(s){
var re = /\.([^\/\.\?]+?)(\?|$)/;
m = re.exec(s);
if(m !=null) return m[1];
}
meible2007 2010-05-25
  • 打赏
  • 举报
回复
这个百度一下太多了。。。
toury 2010-05-25
  • 打赏
  • 举报
回复
var s="http://www.xxx.com/aaa.html?dne=hiejs&jco=snncl";
var postfix=s.split('?')[1]
alert(postfix)
snowhite88 2010-05-25
  • 打赏
  • 举报
回复
substr()

87,904

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧