从URL获取值并使用获取的值打开新的Winfow [英] fetch value from URL and open new winfow with fetched value
问题描述
朋友们,
你能告诉我如何从任何活动页面的URL中获取值,一旦获得包含该值的值,那么我想打开新窗口.
这里我举一个例子,假设这是我当前的URL,单击按钮后会打开新窗口
(https://tools.gakgs.com/gdrp/coiga/showsurvey.do?surveyCode=7189&keyCode=000038167)
现在我想检查键码值",如果找到了,我想用键码值打开新窗口
(https://secure.lomadee.com/at/actionlog"+"?transaction ="+ KeyCode +">"+"&adv = 5742&country = AR&event = 12583)
请帮帮我.
预先感谢....
Hi friends,
Can u Please tell me how can i fetch value from any active page URL, and once i got that value if it contain, then i would like to open new window.
here i m givng example suppose this is my current URL with new window open once i click button
( https://tools.gakgs.com/gdrp/coiga/showsurvey.do?surveyCode=7189&keyCode=000038167 )
now i want to check for " keycode value" and if it found i want to open new window with keycode value
( https://secure.lomadee.com/at/actionlog" + "?transaction=" + KeyCode + ">" + "&adv=5742&country=AR&event=12583 )
Please help me.
Thanks in advance....
推荐答案
您可以使用以下函数(取自 ^ ]):
You can retrieve the querystring from the url using the function below (taken from StackOverflow: how-can-i-get-query-string-values[^]):
function getParameterByName(name)
{
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
var regexS = "[\\?&]" + name + "=([^&#]*)";
var regex = new RegExp(regexS);
var results = regex.exec(window.location.search);
if(results == null)
return "";
else
return decodeURIComponent(results[1].replace(/\+/g, " "));
}
我将剩下打开新窗口的部分交给您(提示:window.open
).
希望有帮助!
I will leave opening the new window part to you (hint: window.open
).
Hope that helps!
这篇关于从URL获取值并使用获取的值打开新的Winfow的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!