I have a text box in my page:
<td>
<input type="text" id="Approvers1" size="11" onkeydown="AddUsersKeyDown(event)" style="width: 470px;" />
</td>
This is my js function:
function AddUsersKeyDown(evtobj) {
if (evtobj.keyCode == 75 && evtobj.ctrlKey) {
AddUsers(--input parameter--);
}
}
Now if i press ctrl k in my textbox it must call another javascript function named AddUsers(--input parameter--).. where the input parameter should be the id of the textbox...
How to achieve this.. Either i need the id of the textbox or atleast the DOM object so that i can access the id of textbox from DOM object..
Kindly help me in achieving either one of the two things..
Use this
to get the DOM element or this.id
to get the id of the element
<td>
<input type="text" id="Approvers1" size="11" onkeydown="AddUsersKeyDown(event,this.id)" style="width: 470px;" />
</td>
function AddUsersKeyDown(evtobj,id) {
if (evtobj.keyCode == 75 && evtobj.ctrlKey) {
AddUsers(id);
}
}