Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

247
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda