Closed
Bug 240503
Opened 21 years ago
Closed 21 years ago
This doesn't work: if (event.ctrlKey && 13 == event.keyCode) { SendGuestbook();
Categories
(Firefox :: General, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: ernstp, Assigned: bugzilla)
Details
Attachments
(1 file)
2.47 KB,
text/html
|
Details |
User-Agent: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.6) Gecko/20040330 Firefox/0.8
Build Identifier: Mozilla/5.0 (X11; U; Linux ppc; en-US; rv:1.6) Gecko/20040330 Firefox/0.8
On this community you are supposed to be able to submit forms by pressing
Ctrl-enter. This feature works in Safari but not in FireFox.
Here is the code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<LINK REL="stylesheet" TYPE="text/css" HREF="/CSS/1.css">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<html>
<head>
<title>Skicka svar till DroWn</title>
</head>
<body onLoad="document.myForm.message.focus();">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
function SendGuestbook()
{
sTmp = jsTrim(document.myForm.message.value);
if(sTmp.length < 2)
{
alert('Du måste skriva åtminstone 2 tecken innan du får skicka ett
gästboksinlägg.');
document.myForm.message.focus();
return;
}
if (sTmp.length > 1024)
{
alert('Du får inte skriva mer är 1024 tecken i ett gästboksinlägg.');
document.myForm.message.focus();
return;
}
window.blur();
document.myForm.submit();
}
var MaxChars = 1024;
var UsedChars = 0;
function CountCharsLeft(form) {
UsedChars = parseInt(document.myForm.message.value.length);
MaxChars = 1024 - UsedChars;
//if (MaxChars >= 0) {
document.myForm.CharsLeft.value = MaxChars;
//}
}
function jsTrim(TXT)
{
return TXT.replace(/(^\s+)|(\s+$)/g,"");
}
function checkSubmit(el) {
if (event.ctrlKey && 13 == event.keyCode) {
SendGuestbook();
return false;
}
return true;
}
//-->
</SCRIPT>
<FORM NAME="myForm" METHOD="post"
ACTION="guestbook_change.asp?action=add&GuestbookID=4249&PostID=99485934&bQuick=True&bHistory=False">
<table border="0" width="100%" cellspacing="0" cellpadding="2">
<tr class="middleframe">
<td colspan="2" class="headline">Skicka svar till DroWn</td>
</tr>
<tr>
<td colspan="2"><TEXTAREA name="message" rows="10" cols="29" WRAP="virtual"
class="largetextarea" onKeyup="CountCharsLeft(this.form);"
onKeydown="CountCharsLeft(this.form);return checkSubmit(this);"></TEXTAREA></td>
</tr>
<tr class="middleframe">
<td class="text1">Tecken kvar: <input type="text" name="CharsLeft" size="6"
value="1024" class="blendininputbox" readonly tabindex="2"></td>
<td class="text1"align="right"><table border="0" cellspacing="0"
cellpadding="0" class="frameborder"><tr class="topframe"><td width="100%"
height="1"></td></tr><tr class="middleframe"><td width="100%" class="subline"
height="15" nowrap> <a href="javascript:SendGuestbook();"
onMouseOver="window.status='Skicka (Ctrl+Enter)';return true;"
onMouseOut="window.status='';return true;">Skicka
(Ctrl+Enter)</a> </td></tr><tr class="bottomframe"><td width="100%"
height="1"></td></tr></table></td>
</tr>
</table>
</form>
</body>
</html>
Reproducible: Always
Steps to Reproduce:
Open a new guestbook or email window.
Fill in a form.
Press Ctrl-enter.
Actual Results:
Nothing.
Expected Results:
Submitted the form.
Comment 2•21 years ago
|
||
It doesn't work like that in Mozilla.
You have to add the event object in the event handler:
<TEXTAREA name="message" rows="10" cols="29" WRAP="virtual"
class="largetextarea" onKeyup="CountCharsLeft(this.form);"
onKeydown="CountCharsLeft(this.form);return checkSubmit(this,event);"></TEXTAREA>
Then you can access the event in the checksubmit function:
function checkSubmit(el,e) {
alert(e);
if (e.ctrlKey && 13 == e.keyCode) {
I hope this helps.
This bug is probably INVALID
Comment 3•21 years ago
|
||
Marking INVALID, feel free to react if you don't agree.
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•