Getting The Pressed Key>

Jan 20, 2005

I want to be able to find out what key the user pressed, rather than just that they pressed one. As far as i can see there is only functionality to get that the user pressed the shift key.

View 5 Replies


ADVERTISEMENT

Detecting Which Key Was Pressed

Oct 1, 2007

example: onkeypress="return eventHandlerFunction(event)"

Why is it that you need the return keyword?
Where does the argument event come from?

I know it works, I just want to know why it works.

I've been looking at some refferences and can't seem to find an answer if someone could give me an explanation or point me to a website, that would be great.

View 2 Replies View Related

Not Dropping To UL When Add Is Pressed?

Dec 16, 2009

The idea I want here is when the user click on a character name from the drop down select bar at the bottom of the the form under case 1 and hits Add it is supposed to add it as a new LI in the UL that's under the drop down. Also what I woudl like to do is when the user as chosen all of the characters they want to I would like to insert the data into the insert tag inside my function at the bottom of this code strip and take the first character selected and put it into the insert with the column of default_char_id and default_news_id.

Right now when you click the right submit button next to the drop down all it does is go back to the default page I have set up.

PHP Code:

<?php 
$e = <<<here
<script src="./jscripts/scriptaculous/prototype.js" type="text/javascript"></script>
<script src="./jscripts/scriptaculous/scriptaculous.js" type="text/javascript">

[Code].....

View 1 Replies View Related

How To Know Tab Key Is Pressed OnBlur Or Onkeypress

Jun 8, 2009

Since key code for Tab key is not working, find whether tab key is pressed onblur or onkeypress

View 5 Replies View Related

Detecting When Back Has Been Pressed?

Aug 8, 2009

I've written a script that displays tooltips when your mouse hovers over a link - all this is fine, but when I click on the link and move to another page, then click the back button on the browser to go back, the tooltip for the link I clicked is still visible! It'd be great if there was a way of detecting the button had been pressed so that I can hide it...

p.s. I tried onclick = "tooltips.hideToolTip(4); return true;" for the links but no joy...

View 1 Replies View Related

Testing Which Button Was Pressed

Mar 10, 2004

does anyone know how I can test, in javascript, which of several buttons was pressed when submitting a form? Currently, I use the onSubmit event handler to call a form validator function, and it is in that function which I would like to test which submit button was pressed. Anyone know?

View 3 Replies View Related

Only Continue If Key Pressed Was Alphanumeric

Jul 9, 2006

I need to stop a function from continuing if the key pressed wasn't alphanumeric or a hyphen. how can this be achieved?

View 1 Replies View Related

Loading Gif When Pressed Submit

May 23, 2011

I'm trying through a form to display a loading gif when pressed the submit button. I've found on the net this code, but something is wrong. If a keep the id="form33" I can see my loading.gif displayed in place of the submit button, but nothing else happen, form not send. If I delete id="form33", I don't see anymore the loading gif, but my form is correctly sent and after few seconds ping2.php is opened..

[Code]...

View 2 Replies View Related

Mouse Movement While A Button Is Pressed

Jul 20, 2005

<BODY onmousemove="return false;" oncontextmenu="return false;">
<IMG src="button.gif" onmouseover="this.src='down.gif'"
onmouseout="this.src='button.gif'">
</BODY>

This simple example shows where my problem is. It works fine when all
mouse buttons are released, and also if a button is pressed outside
the image. But if a button is pressed inside the picture it'll not
call onmouseout when the mouse is brought outside the picture. The
worst is it'll never call it, leaving the button stuck pressed forever
until mouse is moved over it again.

I just noticed if I place the picture inside an A tag it does work
fine then, but I don't need an A element here. Moreover, this fix
appears to work only for IE6, IE4 still doesn't work properly.
I'm asking if there's some other way to correct this. I'm also making
this compatible with Netscape 4.5, and the presence of an A element
changes the event.target.

The fact is I can't seem to disable the default drag'n drop of IE with
pictures. Netscape 4.5 appears to work perfectly. By placing
onmousemove="return false;" in BODY I aboid the cursor change in IE
but nothing else.

View 1 Replies View Related

Capture Event When Ctrl Key Is Pressed

Jul 20, 2005

I want to capture the event when the <ctrl> key is pressed.

View 3 Replies View Related

Recording The Id Of A Input-text If A Particular Key Is Pressed

Aug 2, 2010

I need a javascript that could record the ID/name of a textbox when the user hit delete or backspace to be used on the next page after submission in a PHP script.

There are 96 text boxes, they are all randomly placed on the screen with a question that came from a randomized array's keys (the script later checks the values of the textboxes with the values from the array's keys that correlate to the textboxes by the name/id of the textbox, which is assigned by a for loop that issues the next($array) to assign everything everywhere.

At the same time, it needs to count how many times the backspace/delete were pushed and have that recorded and sent as well.

After 45 minutes of research I've been able to solve the "count the backspace/delete key" problem:

<script type="text/javascript">
var count = 0;
document.onkeypress=function(e){
var e=window.event || e

[Code]....

But onto the name/id issue: I'm not sure how to go about retrieving the names/id of the textboxes. I would assume a onkeypress event for every textbox, but hope that there could be something I could just add to this code.

View 1 Replies View Related

Disable A Function When Ctrl Or Cmd Is Pressed?

May 28, 2011

I want to disable a function when a user is pressing control or command using Javascript. Is this at all possible? My reason for doing this is because I recently implemented lightbox to my script, but I still want users to be able to open the image in a new tab by just clicking control or command when clicking the image rather than opening it in lightbox (which it does).

View 1 Replies View Related

Focus In Textarea After Image Is Pressed?

Nov 11, 2009

I have a textarea where text can be entered and when pressing an image the copy sign will appear. When the copy image is pressed, it is only when the cursor is in the end of the text that the cursor comes after the copy sign.

When the cursor is put in the middle of entered text and the copy image is pressed, the copy sign appears in the end of the text. I would like for the sign to appear whereever the cursor is put and then focused right after the entered copy sign.

The code is:

<html>
<head>
<title>The Text Box</title>
<link rel="stylesheet" href="style.css" type="text/css">

[code]....

View 2 Replies View Related

Way To Check Mouse Button Being Pressed...

Jan 15, 2007

Is there a way to check if user still has the mouse button pressed?

View 2 Replies View Related

Events With Shift, Ctrl Or Alt Key Pressed?

Oct 14, 2010

This is a proof of concept question ... that I've been unable to prove. Ultimate goal to is allow one button to have different actions with the Shift, Control or Alt key pressed for a link "<a...>" or a button ("<input type='button'" or "<button>.") click. The following appears to work in FF and MSIE on PC (with some side-effects), but not at all on a iMac using FF or Safari.

The display in the textarea shows that I can detect when the Shift, Control or Alt keys are pressed and an event is created with a mouse click. With a left mouseClick, the display shows

[Code]...

View 2 Replies View Related

Show And Hide DIV When Button Pressed

Aug 5, 2010

I have an application where at the top I have a div id="title" for the title then in the middle div id="map" I have the google map then bottom I have buttons div id="mainOption". So what I want is that I want another few div at the right. By default one of the div I will fill up with a combo box and and submit button. The problem I want the div only to be shown when I pressed the button at the bottom div.

Below is my code but without the side div.
PHP Code:
<body onload="createMap()" onunload="GUnload()">
<div id="title1" style="padding: 4px; overflow: auto; background-color: #8EB4E3;">
<table border="0" cellspacing="0" cellpadding="0">
<tr><td></td></tr><tr>
<td>OUR SYSTEM</td><td width="11%" height="10"><div align="right"><img src="../fleet/images/logos/<?=$fleetID?>.png" width="100" height="50" /></div></td>
</tr></table></div>
<div id="map" style="width:100%; height:80%">Map goes here.</div>
<div id="mainOptions" style="position:absolute; left: 10px; background-color: #8EB4E3;">
<table border="0" cellspacing="0" cellpadding="0"><tr>
<td><img src="tracking.png" width="128" height="29" border="0" NAME="but1" onClick="change(this)" />
</td></tr></table></div></body>

View 4 Replies View Related

Arrow Key Event - And Store Which Key Was Pressed In A Variable

Feb 24, 2010

I want to use an onkeydown() on my web site and the web site to know which key I pressed. Specifically know I pressed the arrow keys and store which key was pressed in a variable.

View 3 Replies View Related

Change Both Set Of Images In Programme When Up/down Button Is Pressed?

Dec 13, 2010

The below is part of the codes of my image matching programme. The programme loads 2 different series of images in the area and the up/down button is supposed to change each set of the series of images. Currently, the codes only allow one set of the images to be changed. what can be done so that both set get changes when the up/down key is pressed?

Codes:

public void keyReleased(KeyEvent e) {
zoom = false;
repaint();
}

[Code].....

View 1 Replies View Related

Make A Html Button Stay Down When Pressed?

Mar 2, 2011

how do i make a html button stay down when pressed, until another button within a specified group of buttons is pressed, at which point it is released and the other button stays pressed?

View 4 Replies View Related

Changing Image On Page When Button Is Pressed?

Mar 20, 2009

i have built a page which loads content into a div tag from a php page using javascript.

the problem i am having is that the title for eachg page is not inside the div so i keep being left with the same title on each page.

i have tried to change the image using the onmouseup/down functions but this has not worked.

here is the code for the functions

function loadContent(id) {
$("#contentArea").load("rpc.php?o="+id+"");
}
function roll(img_name, img_src)

[Code]....

View 1 Replies View Related

Multiple Function Call When Submit Is Pressed

Dec 28, 2011

i m trying to call multiple function when submit is pressed.i have tried wrapping the functions as well as onsubmit="return validateForm() && checkdate(mydate)"my 1st function is validating if all the columns in the form are filled or not AND.my 2nd function is validating date text box in my form....i m not able to call multiple functions onsubmit [code]

View 1 Replies View Related

Calling A JS Func. When Back Button Pressed?

Sep 30, 2002

Is it possible to call a javascript function when the forward or back browser buttons are pressed? I have a site that loads content into iframes using javscript functions, however this means that the back button doesn't track the history of the user through the site.

View 2 Replies View Related

OnkeyDown Function - Store Key Pressed In Variable

Feb 24, 2010

I want to use an onkeydown() on my web site and the web site to know which key I pressed. Specifically know I pressed the arrow keys and store which key was pressed in a variable. Must work on all browsers.

View 1 Replies View Related

Disable Submit Buttons If Enter Is Pressed?

Jul 22, 2010

I have form within a form and I would like to disable the submit button in the inner form.Currently I have this for some other forms, and it works just finePHP Code:

<form method="post" action="index.php" onkeypress="return event.keyCode!=13">
<input type="text" name="first" value=""  />
<input type="text" name="last" value=""  />

[code]....

View 9 Replies View Related

How To Make A Function Only Run An Image Button Is Pressed

Apr 4, 2011

This is from long complicated code so I can't show everything but how do I make the function only run if an image/button is pressed?

At the moment everything works properly in Chrome, FF and Safari just not IE. code...

View 2 Replies View Related

Retrieve The Keycode That Was Pressed While An Input Is Selected?

Mar 11, 2010

I am trying to retrieve the keycode that was pressed while an input is selected. Here is my code:input.onkeyup = function() { func( this, event ); }

function func( obj, e ) {
alert(e);
...
}

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved