Topic: Punbb + javascript
i have a script, in separate file
function pastequote(){
if(document.postform.req_message) document.postform.req_message.value += txt}
function copyquote(Name){
txt=''
if (document.getSelection) txt=document.getSelection()
else if (document.selection) txt=document.selection.createRange().text
txt='[quote='+Name+']'+txt+'[/quote]\n'}
document.onkeydown = keyDown;
window.onkeypress = keyDown;
function keyDown(DownEvents){
var tt = document.getElementById("postform");
if (document.all)
{
var k=window.event.keyCode;
if (window.event.srcElement.className=='post_text')
{
if (window.event.ctrlKey && k==13)
// document.postform.submit(); - tried this too
tt.submit();
return;
}
}
else
{
var k=DownEvents.which;
if (DownEvents.target.className=='post_text')
{
if (DownEvents.ctrlKey && k==13)
{
// document.forms.postform.submit(); - tried this too
tt.submit();
return;
}
}
}
}
I have
<form id="postform" name="postform" ........> ...<textarea name="post_text">....
This should submit my form if ctrl+enter pressed
So, the code above doesn't work? can anybody help me ?