text: Q:
  
  How to pop up a new window with the same URL + query string
  
  Current window
  http://www.testing.com/default.aspx
  
  or
  http://www.testing.com/default.aspx?id=1
  
  Pop Up Window
  http://www.testing.com/default.aspx?p=1
  
  or
  http://www.testing.com/default.aspx?id=1&p=1
  
  What I have is 
  <a target="_blank" onclick="window.open(document.location.href + '?&p=1')">
   Print Page   
  </a> 
  
  which is a bit wrong as pop up will become 
  http://www.testing.com/default.aspx?id=1?&p=1
  
  i just need a tweak.
  Any idea?
  
  A:
  
  You could do this a few ways... This is how I would make it work:
  <a target="_blank" onclick="window.open(document.location.href + (document.location.href.indexOf('?') >= 0 ?  '&p=1' : '?p=1'))">
   Print Page   
  </a> 
  
  EDIT: Updated to put querystring appending in parentheses.
  
  