Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

219
Vistas
passing value from one page to another using input "type=text" element in javascript

page name 3.html

<html>
    <body>
<form action="4.html" onSubmit="cal()">
    <table>
        <tr>
            <td><input type="text" id="sen"/></td>
            <td><input type="submit" value="tap me"/></td>
        </tr>
    </table>
</form>
</body>
<script>
    function call(){
        var a = document.getElementById("sen").value;
        localStorage.setItem("a",a);
    }
</script>
</html>

page name 4.html

<html>
    <body>
        <table>
    <tr>
        <td><p id="r"></p></td>
    </tr>
</table>
</body>
<script>
    var get = localStorage.getItem('sen');
    alert(get);
    document.getElementById("r").innerHTML=get;
</script>
</html>

i am trying to pass value from 3.html to 4.html but it is passing null value. why is it passing the null value? how to resolve this error?

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

Looks like you have an error when calling the function onSubmit="cal()"

The defined function name is call()

Apart that you are trying to set the session with key a and retrieve it with key seen.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda