开发者

popups based on querystring parameters

My querystring has 2 parameters say pm1 and 开发者_如何学编程pm2. I want to check the value of each and if the value if '1' then pop open a new window(one for each parameter) and the url for the two windows will be different. What is a good way to do this (javascript can be used)?

I am doing this in an asp.net c# web project.


var params = document.location.search.substring(1).split("&");
var values = {};
for(var i = 0; i < params.length; i++)
{
  var p = params[i].split("=");
  values[p[0]] = p[1];
}
if(values.pm1 == "1")
  window.open(pm1url, "_blank");
if(values.pm2 == "1")
  window.open(pm2url, "_blank");

Be warned that popup blocker might block these windows from being opened.


I assume you want to verify if your form fields are equal to one ? you ought to make validation() function .. and put form onsubmit="return validation();" inside that function you should compare values if they equal to one open popup with some static or random url, maybe you could explain a bit further..

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜