CodePen

HTML

            
              <html><head></head><body>
<form name="form1" method="post">
<select name="VarToPass">
<option value="Val1">Val1</option>
<option value="Val2">Val2</option>
</select>
<input onclick="formSubmit()" type="submit" value="Submit">
</form>
</body></html>
            
          
!

CSS

            
              
            
          
!
? ?
? ?
Must be a valid URL.
+ add another resource
via CSS Lint

JS

            
              function formSubmit() {
  //opener.location='https://www.example.com/Not-The-Parent-Page.asp?PassThis=DOCUMENT.FORM1.VARTOPASS.VALUE';self.close();
  
  // create the url
  var url = 'https://www.example.com/Not-The-Parent-Page.asp?PassThis=';
  
  // get the value selected
  var varToPass = document.getElementsByName('VarToPass')[0].value;
  
  // creating the new URL
  var newUrl = url + varToPass;
  
  opener.location = newUrl;
}
            
          
!
Must be a valid URL.
+ add another resource
via JS Hint
Loading ..................