title: How to pass variables to another page?
body: <p>I actually got it to work using the code below.Thanks to all who gave me their inputs, but have to say I had difficulties getting it to work properly. Hope it will be helpful to somebody else who is new in javascript.</p>
  
  <pre><code>function SelectedRow() {
              (function () {
                  if (window.addEventListener) {
                      window.addEventListener('load', run, false);
                  } else if (window.attachEvent) {
                      window.attachEvent('onload', run);
                  }
  
                  function run() {
                      var table = document.getElementById('alternativeCableTable');
                      table.onclick = function (event) {
                          var target = event.target || event.srcElement;
                          while (target &amp;&amp; target.nodeName != 'TR') { 
                              target = target.parentElement;
                          }              
                          var cells = target.cells;              
                          if (!cells.length || target.parentNode.nodeName == 'THEAD') {
                              return;
                          }
                          var stockcode = document.getElementById('stockcode');
                          var wiretype = document.getElementById('wiretype');
                          var wirelength = document.getElementById('wirelength');
                          var terminalA = document.getElementById('termA');
                          var sealA = document.getElementById('sealA');
                          var terminalB = document.getElementById('termB');
                          var sealB = document.getElementById('sealB');
                          stockcode.value = cells[0].innerHTML;
                          wiretype.value = cells[1].innerHTML;
                          wirelength.value = cells[2].innerHTML;
                          terminalA.value = cells[3].innerHTML;
                          sealA.value = cells[4].innerHTML;
                          terminalB.value = cells[5].innerHTML;
                          sealB.value = cells[6].innerHTML;
                          alert("The select data is sent to print page");
                          window.open("http://10.19.13.67/ReworkLabels/PrintLabelPage.aspx?stockcode=" + decodeURIComponent(stockcode.value) + "&amp;wiretype=" + decodeURIComponent(wiretype.value) + "&amp;wirelength=" + decodeURIComponent(wirelength.value)
                         + "&amp;terminalA=" + decodeURIComponent(terminalA.value) + "&amp;sealA=" + decodeURIComponent(sealA.value) + "&amp;terminalB=" + decodeURIComponent(terminalB.value) + "&amp;sealB=" + decodeURIComponent(sealB.value),"_blank");
  
                      };
  
                  }
  
              })();
          }
  </code></pre>