J
Jake Barnes
Please go here:
http://www.cyberbitten.com/groups.php
You can login with this info:
user: test
password: test
I'm on a Linux machine today, so I haven't been able to test this page
using Internet Explorer, but my co-worker tested this page with IE and
says it is working. So the problem is specific to FireFox.
We are using Simon Wilison's function addLoadEvent.
http://simonwillison.net/2004/May/26/addLoadEvent/
What we'd like to do is capture use of the Enter key. First, we use
addLoadEvent to attach the detectEnterKey function to the textarea
called "chat_input":
addLoadEvent(function() {
if (document.getElementById("chat_input")) {
var referenceToChatInputButton =
document.getElementById("chat_input");
referenceToChatInputButton.onkeyup = function() {
detectEnterKey();
return false;
}
}
});
This is one version of detectEnterKey. For some reason, in FireFox, I
have not been able to get the alert() to function:
function detectEnterKey(e) {
if(document.getElementById("chat_input")) {
var referenceToChatInputButton =
document.getElementById("chat_input");
if (referenceToChatInputButton.onkeyup) {
if (window.event) {
keycode = window.event.keyCode;
} else if (e) {
keycode = e.which;
}
alert(keycode);
if (keycode == 13) {
postNewChatMessage();
void(0);
}
}
}
}
Here is another version of the function:
// 1-10-08 - RK - Captures Enter Key Stroke and initiates chat_send
(Talk) button
function detectEnterKey(e) {
if(document.getElementById("chat_input")) {
var referenceToChatInputButton =
document.getElementById("chat_input");
if (referenceToChatInputButton.onkeyup) {
var KeyID = (window.event) ? event.keyCode : e.which;
alert(KeyID);
if (window.event) {
if(event.keyCode == 13) {
postNewChatMessage();
}
}
}
}
}
Again, these capture the Enter key in IE, but not FireFox. What are we
missing?
http://www.cyberbitten.com/groups.php
You can login with this info:
user: test
password: test
I'm on a Linux machine today, so I haven't been able to test this page
using Internet Explorer, but my co-worker tested this page with IE and
says it is working. So the problem is specific to FireFox.
We are using Simon Wilison's function addLoadEvent.
http://simonwillison.net/2004/May/26/addLoadEvent/
What we'd like to do is capture use of the Enter key. First, we use
addLoadEvent to attach the detectEnterKey function to the textarea
called "chat_input":
addLoadEvent(function() {
if (document.getElementById("chat_input")) {
var referenceToChatInputButton =
document.getElementById("chat_input");
referenceToChatInputButton.onkeyup = function() {
detectEnterKey();
return false;
}
}
});
This is one version of detectEnterKey. For some reason, in FireFox, I
have not been able to get the alert() to function:
function detectEnterKey(e) {
if(document.getElementById("chat_input")) {
var referenceToChatInputButton =
document.getElementById("chat_input");
if (referenceToChatInputButton.onkeyup) {
if (window.event) {
keycode = window.event.keyCode;
} else if (e) {
keycode = e.which;
}
alert(keycode);
if (keycode == 13) {
postNewChatMessage();
void(0);
}
}
}
}
Here is another version of the function:
// 1-10-08 - RK - Captures Enter Key Stroke and initiates chat_send
(Talk) button
function detectEnterKey(e) {
if(document.getElementById("chat_input")) {
var referenceToChatInputButton =
document.getElementById("chat_input");
if (referenceToChatInputButton.onkeyup) {
var KeyID = (window.event) ? event.keyCode : e.which;
alert(KeyID);
if (window.event) {
if(event.keyCode == 13) {
postNewChatMessage();
}
}
}
}
}
Again, these capture the Enter key in IE, but not FireFox. What are we
missing?