Jul 12, 2006 #1 onressy Programmer Joined Mar 7, 2006 Messages 421 Location CA if i have a1=document.form.field.value how can i createan attribute for an onkeypress i've tried somethings to no avail, like a1.onkeypress(...
if i have a1=document.form.field.value how can i createan attribute for an onkeypress i've tried somethings to no avail, like a1.onkeypress(...
Jul 12, 2006 1 #2 cLFlaVA Programmer Joined Jun 14, 2004 Messages 6,450 Location US the value won't have a keypress event. you need to attach events to objects. Code: var a = document.forms['form'].elements['field']; a.onkeypress = function() { alert("pressed a key"); }; *cLFlaVA ---------------------------- [tt]( <P> <B>)13 * (<P> <.</B>)[/tt] [URL unfurl="true"]http://www.coryarthus.com/[/url] Upvote 0 Downvote
the value won't have a keypress event. you need to attach events to objects. Code: var a = document.forms['form'].elements['field']; a.onkeypress = function() { alert("pressed a key"); }; *cLFlaVA ---------------------------- [tt]( <P> <B>)13 * (<P> <.</B>)[/tt] [URL unfurl="true"]http://www.coryarthus.com/[/url]
Jul 12, 2006 Thread starter #3 onressy Programmer Joined Mar 7, 2006 Messages 421 Location CA cheers! Upvote 0 Downvote