473,414 Members | 1,563 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

onkeypress

hi

i ve made this

function form(diam, pas){
var form = document.createElement('form');
form.setAttribute('name', diam);
form.setAttribute('id', diam);
var oPas = document.createElement('input');
oPas.setAttribute('type', 'hidden');
oPas.setAttribute('name', 'pas');
oPas.setAttribute('value', pas);
var oAngle= document.createElement('input');
oAngle.setAttribute('type','text');
oAngle.setAttribute('name', 'angle');
oAngle.setAttribute('value', '2');
oAngle.setAttribute('size', '2');
oAngle.onkeypress = 'return deplacement(this.form)';
var oDep = document.createElement('input');
oDep.setAttribute('name', 'dep');
oDep.setActive('size', '4') ;
oDep.setActive('type', 'text');
form.appendChild( document.createTextNode('M' + diam + ': '));
form.appendChild(oPas);
form.appendChild(document.createTextNode('angle')) ;
form.appendChild(oAngle);
form.appendChild(document.createTextNode('deplacem ent :'));
form.appendChild(oDep);
document.body.appendChild(form);
}

when i call the function when the page load

the statement "oAngle.onkeypress" doesn t work
where I have make an error?
i don t need browser compatibilty (it will be use into an IE browser
embedded into pro-engineer wildfire(cad software))
tia

Oct 26 '05 #1
1 2922
jr********@gmail.com writes:
hi

[...]
var oAngle= document.createElement('input');
oAngle.setAttribute('type','text');
oAngle.setAttribute('name', 'angle');
oAngle.setAttribute('value', '2');
oAngle.setAttribute('size', '2');
oAngle.onkeypress = 'return deplacement(this.form)';
assuming 'deplacement' names a function that you previously defined,
you want:
oAngle.onkeypress = deplacement
(document.getElementById('myForm'));
instead of:
oAngle.onkeypress = 'return deplacement(this.form)';

[...]


of course, then you first need to name your form:
[...]
form.id = 'myForm';
document.body.appendChild (form);

Hope that helps,
Arnaud

--
Arnaud DIEDEREN
Software Developer
IONIC Software
Rue de Wallonie, 18 - 4460 Grace-Hollogne - Belgium
Tel: +32.4.3640364 - Fax: +32.4.2534737
mailto:ad@ionicsoft.com
http://www.ionicsoft.com
Oct 26 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Fred Brown | last post by:
Hi, I want to cancel a certain key in JavaScript. To do so, I catch the event in OnKeyPress and cancel the default: <head> .... function f(evt) { var evt = (evt) ? evt : ((window.event) ?...
5
by: Albert Wagner | last post by:
I have included a file below that tests onKeyPress in Opera 7.11. I am getting peculiar behavior. When the file is first loaded, pressing the keypad + causes the textarea to get physically larger...
7
by: Kev | last post by:
I need to make some specific alterations to some JavaScript in webpages in order to comply with government guidelines on accessibility. Apparently, whenever the OnClick event is used, it must be...
2
by: Hasan Ammar | last post by:
Is it possible to set up hotkeys using onkeypress? I know it can be done with the usual alphanumeric keys, but what about function keys? or using ctrl/alt combinations? Does anybody have a...
3
by: addi | last post by:
I'm looking to perform input validation on an HTML input text element; specifically, I'm looking to prevent anything other than numerical characters from being entered. I've got it working just...
11
by: LilAndy23 | last post by:
How can I use the onKeyPress event handler in Firefox? onKeyPress doesn't seem to fire in Firefox.
2
by: ~toki | last post by:
How can i take the control of the key events in Class2 ? This is the code snipped that i'd tried (after try some others): public class Main : System.Windows.Forms.Form { protected virtual...
1
by: Simon Wigzell | last post by:
I'm using a javascript function to interecept all key presses and check for valid character and also check the length of the current string and if it is greater than a sent value, set the focus to...
3
by: Robert Inder | last post by:
I am struggling to catch kestrokes within an Internet Explorer 6 window. My window happens to be displaying three frames, though I suspect a similar problem would arise with a single document. ...
1
by: vega80 | last post by:
Hi. I have a problem with assigning an onkeypress-function to dynamically created input-boxes.I want to put the content of an input-field into a tag-list when the user hits enter. This works...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.