Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

declare attribute 1

Status
Not open for further replies.

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(...
 
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]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top