Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

246
Views
redirect from html text box using js

iam working on javascript and html to redirect page. from three textbox value using in url button is not working why?

code is here

<h3>Enter Reference Number</h3>

<td style="background-color:#f7faff;" width="300">

    <input name="txtBatchNo" type="text" size="2" maxlength="2">
              -
              <input name="txtSubDiv" type="text" size="5" maxlength="5">
              -
              <input name="txtRefNo" type="text" size="8" maxlength="8">
             
              </select></td>

<input type="button" onclick="openPage()" value="Check BiLL">
<script type="text/javascript">
function openPage() {
    var add1 = document.getElementById('txtBatchNo').value;
    var add2 = document.getElementById('txtSubDiv').value;
    var add3 = document.getElementById('txtRefNo').value;
        var url="http://www.lesco.gov.pk:36269/Default1.aspx?BatchNo=" + add1 + "&SubDiv=" + add2 + "&RefNo=" + add3 + "&RU=U&Exec=941N7";
   //alert(url);
   window.open(url,"_blank");
}
</script>```
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Actually you have errors on variables add1, add2 and add3, you're trying to select those elements by Id but they do not have an Id, so your code breaks before opening the page. I fix it here:

<h3>Enter Reference Number</h3>

    <td style="background-color:#f7faff;" width="300">
    
        <input name="txtBatchNo" type="text" size="2" maxlength="2" id="txtBatchNo">
                  -
                  <input name="txtSubDiv" type="text" size="5" maxlength="5" id="txtSubDiv">
                  -
                  <input name="txtRefNo" type="text" size="8" maxlength="8" id="txtRefNo">
                 
                  </select></td>
    
    <input type="button" onclick="openPage()" value="Check BiLL">
    <script type="text/javascript">
    function openPage() {
        var add1 = document.getElementById('txtBatchNo').value;
        var add2 = document.getElementById('txtSubDiv').value;
        var add3 = document.getElementById('txtRefNo').value;
            var url="http://www.lesco.gov.pk:36269/Default1.aspx?BatchNo=" + add1 + "&SubDiv=" + add2 + "&RefNo=" + add3 + "&RU=U&Exec=941N7";
       //alert(url);
       window.open(url, "_blank");
    }
    </script>

Note that the page won't open here, because it will get blocked by the sandbox.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!