Hi everyone,
I am new to using dhtml and was wondering when you create an input element, i.e.
How do you add an event to an input item?Code:var someInput = createElement('input');
like a onKeyUp event.
Thanks,
Nick
| SitePoint Sponsor |
Hi everyone,
I am new to using dhtml and was wondering when you create an input element, i.e.
How do you add an event to an input item?Code:var someInput = createElement('input');
like a onKeyUp event.
Thanks,
Nick
There are multiple ways. The simplest is to use DOM0 events.
For more information, check these out:Code:var someInput = document.createElement('input'); someInput.onkeyup = function(e){ e = e||window.event; var key = e.which||e.charCode||e.keyCode; alert(key); }
http://www.quirksmode.org/js/contents.html#events
http://www.brainjar.com/dhtml/events/
http://developer.apple.com/internet/...entmodels.html
We miss you, Dan Schulz.
Learn CSS. | X/HTML Validator | CSS validator
Dynamic Site Solutions
Code for Firefox, Chrome, Safari, & Opera, then add fixes for IE, not vice versa.
Bookmarks