Skip to main content

Posts

Showing posts with the label variable

how to pass one variable to other page or same page | JS | HTML

How to pass one variable to another page or same page?  So, Here I have given two file's code where one is data sending file. And another one is data receiving file if we transfer to another page. index.html <form action="#tp" method="get"> <input type="text" name="serialNumber" Value="rajnish" /> <input type="submit" value="Submit" /> </form> <div id="tp"> <div id="data"> </div> </div> <script> function processForm() { var parameters = location.search.substring(1).split("&"); var temp = parameters[0].split("="); l = unscape(temp[1]); document.getElementById("data").innerHTML = l; } processForm(); </script> Here above code will be used only when you want to pass a variable on one page only. <form action="#tp" method="get"> <i...