marius123 Posted August 18, 2020 Report Share Posted August 18, 2020 I have created the following html page in Dreamweaver. When the user enter an age >39 the webpage must load else the alert message must be displayed. What am I doing wrong? <!DOCTYPE html> <html> <body> <h2>HTML Forms</h2> <form action="" onSubmit="myFunction()"> <label for="fname">First name:</label><br> <input type="text" id="fname" name="fname" value=""><br> <label for="lname">Last name:</label><br> <input type="text" id="lname" name="lname" value=""><br><br> <input type="submit" value="Submit"> </form> <script type="text/javascript"> function myFunction(){ var fname = document.getElementById("fname").value; if(fname > 39) { loadPage('http://www.mdrtrust.co.za');>Home<div> } else alert("Condition Not met") } </script> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.