Jump to content

Load webpage in JS


marius123

Recommended Posts

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>

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...