1

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.

2 Answers 2

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.