All I have the following code:
Code:
<form name="testimonial" id="testimonial" method="post" action="">
<table border="0" cellspacing="3" cellpadding="3">
<tr>
<td valign="top">Name:</td>
<td><input type="text" name="name" id="name" value="Enter your name" onfocus="if(this.value=='Enter your name'){this.value=''}"/></td>
</tr>
<tr>
<td valign="top">Message:</td>
<td><textarea name="message" id="message" cols="30" rows="10" onfocus="if(this.value=='Enter in a testimonial'){this.value=''}">Enter in a testimonial</textarea></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="submit" value="Submit Testimonial" onclick="get(this.parentNode);"/></td>
</tr>
</table>
</form>
Then I submit it using an AJAX code. I try and reset these values using the following code:
Code:
http_request.onreadystatechange = function() {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
//alert(http_request.responseText);
result = http_request.responseText;
document.getElementById(SpanName).innerHTML = result;
document.getElementById('name').innerHTML = 'Enter your name';
document.getElementById('message').innerHTML = 'Enter your message';
} else {
alert('There was a problem with the request.');
}
}
};
http_request.open('POST', url, true);
http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http_request.setRequestHeader("Content-length", parameters.length);
http_request.setRequestHeader("Connection", "close");
http_request.send(parameters);
}
However, it doesn't work. Any ideas why? Thanks in advance!