views:

51

answers:

2

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.

A: 

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..

c0mrade
+1  A: 
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.

Amarghosh