I have an assignemnt due this week and i cant figure out why i my code wont work. i have very little knowledge about javascript and HTML so please help!!!!!
Make HTML5 page that can either retrieve data from a database table based on a user_name and user_password on the form or insert a new entry into the database for the incident reporter (as done in Assignment01). The retrieval extracts the Incident data for the user from the database. Use a POST method for the insert and a GET method for the retrieval. This implies that there are two alternative forms, which appear on one page. Make one or the other form "appear" on the page
in response to the user clicking one of a pair of buttons.
Add a Javascript function that checks if a 2nd copy of the password entered on the form is the same as the 1st copy entered, and warns the form-filler if they are not the same. The event that triggers the comparison of the two copies of the password can be, for example, an onblur event.
This is my HTML code....i dont why i cant get it to work
<html>
<body>
<label><b>Click the button for the services you want!</b></label> <br>
<input type="button" value="Insert Incident" onclick="display(Insert Incident)" /></input>
<input type="button" value="Retrieve Incident" onclick="display(Retrieve Incident)" /></input>
<div id= "Insert Incident" style="display:none;" >
<form action="hello.txt">
<script>
function display (Insert Incident){
if ()
document.getElementById('Insert Incident').style.display = 'block';
else
document.getElementById('Retrieve Incident').style.display = 'none';
}
function compare ()
{
var v1 = document.getElementById("p1").value
var v2 = document.getElementById("p2").value
if (v1 != v2){
document.getElementById("s1").innerHTML = "Warning, Passwords don't match!"
document.getElementById("s1").style.background = "red"
}
else{
document.getElementById("s1").innerHTML = ""
}
//var v2 = dcoument.getElementById("p2").value
//alert(v1)
}
</script>
<fieldset>
<legend><b>INSERT</b></legend>
<label>User Name</label>
<input type="text" name="Name" placeholder= "Enter User Name" autofocus autocomplete="off" required="required"/><br><br>
<label>Password</label>
<input type="password" name="Password"id="p1" placeholder= "Enter Password" id="p1"> <br>
<label>Confirm Password</label>
<input type="password" name="Confirm Password" id="p2" onblur = "compare()" placeholder= "Enter Password" id="p2"> <br><br>
<label>Content</label><br>
<textarea name="Content" placeholder="Whats your incident?" rows = 5 cols = 30 required="required" ></textarea><br>
<span id = "s1" ></span><br>
<input type="submit" value="Submit" /> <br><br>
</fieldset>
</form>
</div>
<div id= "Retrieve Incident" style="display:none;" >
<form action="hello.txt">
<fieldset>
<legend><b>RETRIEVE</b></legend>
<label>User Name</label>
<input type="text" name="name" placeholder= "Enter User Name" /><br><br>
<label>Password</label>
<input type="password" name="Password" placeholder= "Enter Password" /><br>
<label>Confirm Password</label>
<input type="password" name="Confirm Password" placeholder= "Enter Password" /><br>
<input type="submit" value="Submit" /> <br><br>
</form>
</div>
</body>
</html>