launch two actions in one button ASP.NET
Posted
by AZIRAR
on Stack Overflow
See other posts from Stack Overflow
or by AZIRAR
Published on 2010-06-12T17:17:04Z
Indexed on
2010/06/12
17:22 UTC
Read the original article
Hit count: 319
Hey,
I'm developing a comment page in asp.net
, this my page :
<form action="#">
<p><textarea id="textArea" rows="5" cols="30"></textarea></p>
<input type="submit" value="Submit" />
</form>
<p>Add some comments to the page</p>
And this is my javascript code :
window.onload = initAll;
function initAll() {
document.getElementsByTagName("form")[0].onsubmit = addNode;
}
function addNode() {
var inText = document.getElementById("textArea").value;
var newText = document.createTextNode(inText);
var newGraf = document.createElement("p");
newGraf.appendChild(newText);
var docBody = document.getElementsByTagName("body")[0];
docBody.appendChild(newGraf);
return false;
}
Until then, everything is fine, but I want when the user clicks the submit
button, the button will trigger another action that will save the comment in the database.
How can I do this thing ?
© Stack Overflow or respective owner