//Get the form object
var form=document.getElementById(‘my_form’);
//Username input object user_name is the name attribute of the object
var userName=form.user_name;
//Clear username
userName.value='';
//User password input object password is the name attribute of the object
var password=form.password;
//Clear user password
password.value=”;