469,306 Members | 2,121 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

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 2868
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Fred Brown | last post: by
5 posts views Thread by Albert Wagner | last post: by
7 posts views Thread by Kev | last post: by
2 posts views Thread by Hasan Ammar | last post: by
11 posts views Thread by LilAndy23 | last post: by
2 posts views Thread by ~toki | last post: by
1 post views Thread by Simon Wigzell | last post: by
3 posts views Thread by Robert Inder | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.