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
ADVERTISEMENT
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
Jan 4, 2010
I am new to jQuery and I would like to process a matrix operationusing PHP.The front-end code is done bellow, its a 3x3 table. the user couldselect/deselect individual cells of the table and click the buttonthat calls a PHP script that will run some function. How do I know if a cell is selected? Is there is is_selectedfunction in jQuery? Would it be possible to send a 3x3 array to my PHP script?Please provide me with any info on thisMTMy current test code.
<html><head><title>Test</title>
<script type='text/javascript'
src='http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js'></
[code]....
View 4 Replies
View Related
Oct 28, 2010
I'm trying to get the value of an input box after a delete key has been pressed at a certain position. For example: If I have: afghanistan and my caret is at position 4 and I push delete I will be left with: afghnistan I'm able to determine the caret position and detect the delete key and then I am trying to use slice to return the new value of the string like: Code: value.slice(caretPosition,caretPosition+1) This returns the value of what was sliced out of the string - how can I modify the parameters of slice to return everything BUT the removed part?
View 6 Replies
View Related
May 25, 2011
I'm working on a forum. What I desire is to let user customize his own test. To do that I have to retrieve the user selected text. That's my problem. I don't know a jquery function to do that
View 6 Replies
View Related
Jun 18, 2010
I'm using the Epoch calendar at:[url]
It works great and does exactly what I need. I'm using it in flat mode so that it can be displayed statically on the page. What I can't seem to work out is how to retrieve the selected date once clicked on. I need to be able to print the output in dd/mm/yyyy format, either on screen or in an alert or something similar.
If anyone has worked with this calendar and knows how to do it, or can sort it, I'd appreciate it greatly. I can't paste code here as it's too long, but the source code on the site linked above is exactly the same as I'm using.
View 5 Replies
View Related
May 19, 2010
like for example i have text areas named upload1 and upload2when I click or add input on upload1 a drop down list below upload2 will not change, but when I add input on upload2 the dropdown will select "parts"
View 3 Replies
View Related
May 17, 2010
This is my issue:I've got a simple poll
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
[code]....
View 6 Replies
View Related
Apr 10, 2009
I have a order form that adds up all the input boxes (45) and then totals them using function updatePrice() (which works) Im trying to have the output as XX.XX and cant figure out how to get the number from the id=txtTotal into the function round() and return the formatted number to txtTotal.
[Code]...
View 4 Replies
View Related
Jan 1, 2012
so, the pseudo code: - on change of input contents, check to see if two input fields are set - if set, update a third field with "loading..." text and a loading gif - use ajax to send data to a url, and get a calculated json response - update the third field with the calculated response
I know I'm getting the correct response, according to firebug: {"pace":"10:00"}
the code:
$('#run_distance').change(function() {
if ($(this).val() != '' && $('#run_time').val() != '')
{
$('#run_pace').val('Calculating Pace…');
[Code].....
how to update the #run_pace input field with the json response.
View 2 Replies
View Related
Jan 16, 2009
I'm trying to make a template generator. I want the visitor to select a background (options: none, color, image). If 'color' or 'image' are selected, I need the appropriate text input field to be displayed.
I've found code to do this which I was able to understand and install. I've also found code that was well beyond my current understanding and that I couldn't get to work to save my life.
The problem is that the code snipped I found and installed is designed to work with a single dropdown, and it's beyond me to figure out how to turn it into a function that could be applied on the page multiple times. I have no idea if it is possible with this piece of script, but that is what I need to have whatever script I use do on the page.
This is the snippet I installed:
Code:
function Choose(op) {
document.getElementById('None').style.display='none';
document.getElementById('Color').style.display='none';
document.getElementById('Image').style.display='none';
[Code]....
View 3 Replies
View Related
Jul 21, 2009
I would like to know if there is a way to get the selected input field inside an Iframe from the parent window, is there any way to do that?
View 3 Replies
View Related
Jul 25, 2009
I have a page with a default avatar image and a input box below it. Its a form. The thing i want to do is that, i want the default avatar image replaced after a user selects a image from the input tag.my code is some like this.
<img src="imagedefault.jpg">
<input type="file" name="select">
Is there a method using javascipt or any other language.
View 4 Replies
View Related
Sep 23, 2011
how to returnthe selected textofainput?
View 2 Replies
View Related
Apr 10, 2009
I am having a form with a drop down and want to display the fields below it based on the drop down value selected.
for example: my form has a drop down <select value> <values: A, B ,C, D)
when I select A then I should get displayed a set of fields ( like input fields, drop down fields etc) just below the main drop down and when I choose B then it should display a set of fields specific to B and like that..
View 1 Replies
View Related
Apr 10, 2009
I am having a form with a drop down and want to display the fields below it based on the drop down value selected. For example: my form has a drop down <select value> <values: A, B ,C, D) when I select A then I should get displayed a set of fields (like input fields, drop down fields etc) just below the main drop down and when I choose B then it should display a set of fields specific to B and like that. What technology / script to use this to achieve this. I have also attached the sample html page.
View 1 Replies
View Related
Nov 20, 2007
<select name="pay" style="letter-spacing:.06em;font-family:Verdana,Sans-Serif;font-size:11px;">
<option value="">choose</option>
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
can some one help me with a script that opens a <input type=text under this select list when a/b/c choosen? normally this <input type=text, do not have to apear there at all if those options not choosen.
View 2 Replies
View Related
Nov 17, 2005
The keyCode of '&'=55 and the keyCode of ƍ'=55 also...
How can you know what a person typed if you get the same keyCodes?
View 14 Replies
View Related
Dec 30, 2011
I would like to disable a feature on my site if someone is in a textarea or input text field. Yet I can't seem to figure out how to check for this... Could someone give me an example of how I can determine if a user does not have a text input or textarea selected? Can't seem to get anything I found via google working.
View 2 Replies
View Related
May 24, 2010
I have a page as below, I hope the form only show Select option when loading, then the input date fields will be displayed if select event category, where are the errors?
Code:
<script src="/misc/jquery/jquery.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
$.viewInput = { '0' : $([]),
//THIS IS THE NAME OF THE DIV WRAPPING THE HIDDEN FIELD
'1' : $('#1'),
};
$('#category_class').change(function() {
// HIDES THE INPUT FIELD IF ANOTHER DROPDOWN ITEM IS SELECTED ONCE THE HIDDEN FIELD IS LOADED
$.each($.viewInput, function() { this.hide(); });
// SHOWS THE INPUT FIELD ITEM IF SELECTED
//$.viewInput[$(this).val()].show();
}); });
</script>
<table cellpadding=4 cellspacing=1 width="650" border=0 class='list'>
<tr> <td class='caption'>
<form action="save.asp" name="pvt_spec" method="post">
<table border=0 cellpadding=4 cellspacing=0>
<div id="1"> <tr>
<td nowrap><font size=2 color="#ff0000"></font>Start Date</td> <td class='data'>
<input onClick="this.select()" tabindex="1" type="text" name="s_dt" value="2000/01/01" size="13" maxlength="13" STYLE='text-align=center;'>
</td> </tr> <tr>
<td nowrap><font size=2 color="#ff0000"></font>End Date</td> <td class='data'>
<input onClick="this.select()" tabindex="1" type="text" name="f_dt" value="2078/12/31" size="13" maxlength="13" STYLE='text-align=center;'>
</td> </tr> </div> <tr> <td>category</td> <td class='data'>
<select name="category_class" id="category_class" tabindex=1><option value="1">Base category</option><option value="2">Parent Event Category</option><option value="3">Son Event Category</option></select>
</td> </tr> </td> </tr> </table>
View 9 Replies
View Related
Oct 5, 2009
keyCode and which will get the same value, so anything different?
<script>
$(function() {
$(window).keydown(function(e) {
console.log(e.keyCode);
console.log(e.which);
});
});
</script>
View 1 Replies
View Related
Oct 20, 2005
I'm trying to figure out what key the user pressed using a Danish
keyboard layout. charCodeAt returns the correct number, but
event.keyCode returns a wrong number, when using one of the keys that
are different on a Danish keyboard layout. "-" returns 45 and 189
respectively. Etc. (The input-field in the sample code below displays
the right character).
I've tried setting the lang-parameter to 'da', but it doesn't make a
difference.
sample code:
<input type="text"
onkeyup="alert(this.value.charCodeAt(this.value.length-1));alert(window.event.keyCode);">
Am I missing something, or is the event.keyCode in IE hardcoded to an
english keyboard layout? Is there a way to automatically convert the
event.keyCode so it corresponds with the users keyboard?
View 4 Replies
View Related
Oct 21, 2005
I want to overwrite the CTRL+S key via 'onkeypress' so, that the
browser doesn't recognize it as 'Save page as ..' command.
I assumed, that calling 'evt.preventDefault()' in my event-handler
would be sufficient. It isn't.
View 1 Replies
View Related
Jul 20, 2005
I have:
<div onkeypress="go(event)">...</div>
and:
function go(event) {
alert(event.keyCode);
}
but I always get 0 for the keycode.
View 3 Replies
View Related
Sep 15, 2009
I have a 3 textareas that when the user presses the spacebar I would like for the code to execute a TAB to move between them instead. My code works if I make the replacement keycode an number or letter but it wont work if I use TAB. The browser is IE. code...
View 4 Replies
View Related
Feb 27, 2006
I got this (piece of) script from 'DHTML Utopia - Modern Webdesign - Using Javascript & DOM'.
function aKeyWasPressed(e) {
if (window.event) {
var key = window.event.keyCode;
} else {
var key = e.keyCode;
}
alert('You pressed the key: ' + String.fromCharCode(key));
}
It is example of adding an eventlistener to a textarea. The events works alright, but when I press 'a' the alert gives me 'A', when I press Ǝ' I get 'h', when I press Ɔ' I get ''', when I press 'à' I get Ɔ', .... Has probably something to do with the fact that I don't live in the UK or
USA. But it shouldn't matter; a key is a key.
View 3 Replies
View Related