<html>
<head>
<script>
function confirmInput() {
fname = document.forms[0].fname.value;
alert("Hello " + fname + "! You will now be redirected to www.w3Schools.com");
}
</script>
</head>
<body>
<form onsubmit="confirmInput()" action="https://www.w3schools.com/">
Enter your name: <input id="fname" type="text" size="20">
<input type="submit">
</form>
</body>
<!-- Mirrored from www.w3schools.com/js/tryit.asp?filename=tryjs_events_onsubmit by HTTrack Website Copier/3.x [XR&CO'2014], Mon, 27 Jan 2020 02:40:41 GMT -->
</html>