blm126
07-26-2006, 12:12 PM
The title pretty much sums it up. I have form that contains a textarea and a submit button.What I would like is when you are typing in the textarea you could just press control+enter and the form would be submitted.But I can't get it working :( .Here's what I have.
<script type="text/javascript"><!--
function ctrle(e,form){
var evt=window.event? event : e;
if (evt.ctrlKey && evt.keyCode == 13){
form.submit();
}
else{
return true;
}
}
//--></script>
<form id="form" onkeydown="ctrle(e,this)" action="posting.php" method="post" name="post">
<textarea class="post" name="message" rows="10" cols="50" wrap="virtual"></textarea><br />
<input type="submit" name="post" class="mainoption" value="Submit" />
</form>
Any help is appreciated.
<script type="text/javascript"><!--
function ctrle(e,form){
var evt=window.event? event : e;
if (evt.ctrlKey && evt.keyCode == 13){
form.submit();
}
else{
return true;
}
}
//--></script>
<form id="form" onkeydown="ctrle(e,this)" action="posting.php" method="post" name="post">
<textarea class="post" name="message" rows="10" cols="50" wrap="virtual"></textarea><br />
<input type="submit" name="post" class="mainoption" value="Submit" />
</form>
Any help is appreciated.