PDA

View Full Version : Event not Recognized


Omega3
09-24-2002, 06:53 PM
Just discovered this cool web site today (9/24/02). I have a Javascript that doesn't seem to recognize the onkeyup event. I copied it from an existing script on the web and the demo on the web worked but can't get it to work on my machine. The snippet is...

<FORM METHOD="POST" NAME="frmMemo">
<input type="text" name="txtSearch" onkeyup="MyTest()" size=20>
</FORM>

The MyTest function is in the Head tag with a simple alert statement. The script language attribute is Javascript. I don't specify a version. Does my default version not recognize the onkeyup event for a text box? I know I'm overlooking something simple.

Thanks for the help.

ConfusedOfLife
09-24-2002, 07:14 PM
I just tried the following code and it's working fine for me:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<script>
function MyTest()
{
alert('hello');
}
</script>
</head>

<body>

<!--<input type="text" onkeyup="alert('damn');">-->
<FORM METHOD="POST" NAME="frmMemo">
<input type="text" name="txtSearch" onkeyup="MyTest()" size=20>
</FORM>


</body>
</html>




If this doesn't work for you, then I have no idea why it's not working, unless it's something wrong with your the "post" in the form.

beetle
09-24-2002, 08:35 PM
Looks fine to me too. Can we see the rest/more of your code Omega?

Here's a link (http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onkeyup.asp) to the MSDN reference for the onkeyup event for more info

Omega3
09-25-2002, 12:10 AM
ConfusedOfLife,

I took your code and pasted it into my editor and it still didn't work. So then I began to doubt my editor. It has a built-in browser. So I opened it in IE and it worked fine! I thought I tried my own code in IE first before posting the question but I guess not. Everything works fine now in IE.

Thanks for the code and help.

ConfusedOfLife
09-27-2002, 06:33 PM
What's your editor? I'm not really asking the name of your editor! but HOMESITE is a good choice I think, you can find it in www.allaire.com and it's cool!

Omega3
10-09-2002, 09:04 PM
Hi Bijan,

Sorry but it’s been awhile to reply. I know you really weren’t interested in what I use as an editor but I do used EditPlus. Obviously they have a weak built-in browser but reasonable priced. I like it because it also recognizes Java code as well.

Thanks for the tip on Homesite. Just curious but can Homesite edit Java code?

I looked at your web site and it looks pretty good with the animation you have running. Do you have a job in web design over there in Iran? It would put your talents to good use. If not, what type of work do you do or are you a full time student?

Keep in touch!