This is the simple html code, with the script I have :
var v1 = document.getElementByID("goo");
window.alert(v1[0].value + " " + v1[1].value);
<html>
<form id="goo">
<input type="text" id="one">
<input type="submit" name="submit" value="submit">
</form>
</html>
I want to display the form values when the user clicks submit. One way of doing it would be to make the script a function ( say function f1() ) and then modify the form tag as:
<form id="goo" onsubmit="f1()">
However, is there a way to do it without modifying the html code and using only Javascript?
Why would I want to do it? I'm new to this and I'm just curious.