|
|
![]() |
| Thread Tools | Search this Thread |
#1
| |||
| |||
How to call event javascript onkeyup Hi, I am newbie in java world. I want to know how can I call a event javascript onkeyup. I want a basic idea of it. As I am not a advance programmer. I need to prepare something of my project work. For example I am trying to create a event which more likely related to currency converter. But I am confused with the syntax. It will be great if someone paste some examples also. Regards. |
#2
| |||
| |||
Re: How to call event javascript onkeyup It is an event which works to define the actions performed while the key on the keyboard is released. Whenever the key in the keyboard is pressed and released the onekeyup is activated immediately. It is not an reserved word. So it is possible to configure your own variable and function. It is an quiet easy event. I posting the basic function which you can edit in your script. The example is : Code: <input type="text" onkeyup="myFunction(this)"> |
#3
| |||
| |||
Re: How to call event javascript onkeyup The onekeyup event handler runs the specified JavaScript function at the time of key press event. It is runs at once when a use release the key from depressed position. The syntax for one key up is onKeyUp="ExampleText" and the parameter for that is ExampleText JavaScript code or a call to a JavaScript function. I am posting a basic example to give you a general idea about the event. Sample of a script : HTML Code: <html> <head> <script type="text/javascript"> function upperCase(x) { var y=document.getElementById(x).value; document.getElementById(x).value=y.toUpperCase(); } </script> </head> <body> Enter your name: <input type="text" id="fname" onkeyup="upperCase(this.id)"> </body> </html> |
#4
| |||
| |||
Re: How to call event javascript onkeyup Normally it is a function which occurs when a user press the key and release it. Setting up specific parameters and functions make you work much easier. The event handler with proper format can preform the action which you want to execute. The sample of script below works for docs, images, links, and text. The properties which onKeyUp event handler uses is type which is used to run the type event, target which is shows the object to which the event is assigned, layerX and layer Y, pageX and page Y and screen X and screen Y is the location of cursor at the time of KeyUP, which is denotes the key released on ASCII values and modifiers is an list of keys hold at the time of event. Refer the below sample script. HTML Code: <body> <form action="" method="POST" id="myForm"> <input type="text" name="myText" onKeyUp="changeVal()"> <script type="text/javascript" language="JavaScript"> s1 = new String(myForm.myText.value) function changeVal() { s1 = "You released a key" myForm.myText.value = s1.toUpperCase() } </script> </form> </body> |
![]() |
|
Tags: call, event, java, key, script, syntax |
Thread Tools | Search this Thread |
|
![]() | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
using href vs. onclick to call javascript function | Kalyug | Software Development | 6 | 12-05-2010 10:09 AM |
Can I Define and Call my Own Functions in JavaScript? | Rob Dizzle | Software Development | 5 | 09-02-2010 05:18 AM |
How to call Readonly textbox in Javascript Function | Aldous | Windows Software | 3 | 12-08-2009 11:39 AM |
Help me with onChange javascript event for php form | Brake Fail | Software Development | 3 | 22-07-2009 11:42 PM |
Call Javascript function in VB.Net code | kaartik | Software Development | 4 | 22-01-2009 06:14 PM |