Help with javascript - alert not displaying

Does anyone know how can I resolve the following: I want the form input by the user, to be alerted in a different HTML file.

This is what I wrote so far. It works for the id called ‘name’, but I dont know why it does not for the ‘position’.

“index.html” file:

	function myFunction() {
        name = document.getElementById("name").value;
    	position = document.getElementById("position").value;
    	return false;

<form class="formulario" onsubmit="return myFunction()">
	  Name: <input type="text" name="name" id="name"><br>
	  Position:  <input type="text" name="position" id="position"><br>
	  <input type="submit" value="Generate Signature">

“signature.html” file - notice the alert(name) and the alert(position) => the alert(name) works, but not the alert(position). I want to understand how to fix that please.

<div class="signature_general">
	<div class = "signature_middle">
		<div id = "signature_details">
		<font size="2px">Regards,</font><br>
		<b><font color="#808080" size="3px" id="nameInput">Francisco Jurado</font></b><br>
		<font size="2px" id="posInput">Accounting Systems Team Leader</font>



Thanks very much

I think that when you use window.location.replace, you are in fact loading a new page (without the back history) and loose every variable that were declared before.

As for the fact that you can maintain the ‘name’ value, it might be because you are renaming the ‘’ propriety of the windows (tab…): Window name Property.
To test it, you can enter ‘’ in the browser console or just ‘name’.

It should happen like this because you are not declaring the variables with var. So the browser assumes that you are trying to change an existing property/object, since it doesn’t have a variable ‘name’.

If you want, you can pass your variables values as URL parameters to a new windows. See this stackoverflow issue for more about it: Additional parameters in window.location.replace