I have several entries for Visitors where I would like to have Clear/Reset link for each Visitor information so someone could clear an entry for a specific Visitor before submitting the form.
My attempt is not working. Please advise.
My JavaScript part:
My attempt is not working. Please advise.
Code:
Visitor One Information<br>
Visitor One<input type="Text" name="Visitor"><br>
City One<input type="Text" name="City"><br>
<a href="#" onclick="return vis1();">Clear/Reset Visitor 1 Info</a><br><br>
Visitor Two Information<br>
Visitor Two<input type="Text" name="Visitor2"><br>
City Two<input type="Text" name="City2"><br>
<a href="#" onclick="return vis2();">Clear/Reset Visitor 2 Info</a>
My JavaScript part:
Code:
function vis1()
{
var e = document.thePage;
if((e.Visitor.value != "") && (e.City.value != "")) //if data is populated
{
e.Visitor.value == ""; //clear field value
e.City.value == "";
}
}
function vis2()
{
var e = document.thePage;
if((e.Visitor2.value != "") && (e.City2.value != ""))
{
e.Visitor2.value == "";
e.City2.value == "";
}
}