如何在javascript中获取查询字符串值 [英] how to get query string value in javascript
本文介绍了如何在javascript中获取查询字符串值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
hii all
i有一个asp.net页面,它将一个查询字符串传递给另一个页面。
i想要检查那个查询字符串,但是在javasript中。
$(凭证).ready。
任何建议......
谢谢
hii all
i have asp.net page which passes a querystring to another page.
i want to check about that querystring but in javasript.
$(document).ready.
Any Suggestion......
Thanks
推荐答案
(文件).ready。
任何建议。 .....
谢谢
(document).ready.
Any Suggestion......
Thanks
unction getQuerystring(key)
{
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,\\\]);
var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
alert("SOme message");
else alert(qs[1]);
}
Hey Dude ..
你可以得到&安培;使用以下行在JavaScript中提取查询字符串。
Hey Dude..
You can get & extract the query string in JavaScript using the following Lines.
var qrStr = window.location.search;
qrStr = qrStr.split("?")[1].split("=")[1];
希望这个
将有助于...:)
Hope this
will help...:)
这篇关于如何在javascript中获取查询字符串值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文