使用prototype js库匹配Href url
Href url match using prototype js library
在我的系统中,我使用的是prototype js。
现在我想要match any href with using href.match and do want something
.
尝试做某事,但它会产生问题express
Suppose: my url
www.example.com/customer/account/login/an/aaa ? 333 = sddssdsd sasaas
想要这样:
如果任何三个ref包含customer/account/login/
,那么我的条件应该是有效的。试试下面这个:
if(accountlink.href.match(/'/customer'/account'/login'//)){
//do someting
}
但这是条件,当url:
-
www.example.com/customer/account/aaa/
-
www.example.com/aaa/account/login/an/
我不想这样。
希望就像如果href包含customer/account/login/
那么它工作。
请帮帮我。
你可以使用普通的javascript来做到这一点:
var url = 'www.example.com/customer/account/login/an/aaa?333=sddssdsd,sasaas'
if (url.indexOf('customer/account/login/') > -1) {
// Do your stuff
}
Ref。: (http://www.w3schools.com/jsref/jsref_indexof.asp)
相关文章:
- 我可以使用location.href为变量生成url吗
- 如何在 jQuery 中将 HTML 标记的 HREF URL 替换为不完整的属性
- 什么时候是 window.location.href = url 被执行
- 当鼠标悬停在链接上时,从 href URL 中隐藏状态栏值
- 单击 标记时,显示叠加层,如果选择“是”作为选项,则跟随 的 href URL
- 在所有 href URL 中附加新路径
- JavaScript 中的函数在通过单击 href url 加载新页面时不会调用
- Javascript:如何在使用 window.location.href = url 导航到的页面上捕获错误
- 使用php变量+javascript变量创建一个href-url
- C#WebBrowser组件忽略window.location.href=url
- 在 Firefox 上,window.open(url) 和 window.location.href = url 有什
- Knockoutjs函数,用参数设置href url
- jQuery获取文档中的所有href url并截断或拆分它们
- 阻止访问任何第三方javascript代码的href url
- 用javascript/jQuery将href url从桌面切换到移动设备
- 在handlebars模板中构造一个href url
- 在事件单击函数中添加href url
- 使用prototype js库匹配Href url
- 在ng-repeat上提供不同href URL的更简洁的方法
- 浏览器如何执行这段javascript代码:window.location.href="url"