Forum Moderators: open

Message Too Old, No Replies

onKeyUp not working in IE

Can someone tell me why the following doesn't work in IE?

         

pixeltierra

6:33 pm on Jan 23, 2007 (gmt 0)

10+ Year Member



<script language="javascript">

function showmsg() {
alert("hi world");
}
</script>

<input size='20' onKeyUp="showmsg()">

birdbrain

6:48 pm on Jan 23, 2007 (gmt 0)



Hi there pixeltierra,

It works OK for me. ;)

Your code could do with some minor modifications, though...


<script type="text/javascript">

function showmsg() {
alert('hi world');
}

</script>

<input type="text" size="20" onkeyup="showmsg()"/>


birdbrain

pixeltierra

6:58 pm on Jan 23, 2007 (gmt 0)

10+ Year Member



I stripped down the code for readability.

I think I've found the bug. I was using IE tabs in firefox, and it didn't work there. Very weird. As soon as I used a separate window it worked fine. Anyone have trouble with IE tabs?

Fotiman

7:38 pm on Jan 23, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



pixeltierra, the point that was being made was:

1. language attribute should not be included. Instead, use type="text/javascript"
2. onKeyUp should be all lower case.

pixeltierra

7:21 am on Jan 24, 2007 (gmt 0)

10+ Year Member



Thanks for the tips.