Trigger a button with the ENTER key in an webapplication

Hi I’m trying to fix a problem in one of the webapplications I’m working on.

In the Application I’ve a $$ViewTemplate with some buttons for browsing the views, like “Pervious Page”, “Next Page”, “Expand All” & “Collapse All”. Now I coded a button that uses text from a textfield to jump to positions in view, like that:

var prot;

if (frm.HTTPS.value==“OFF”) {prot=‘http://’} else {prot=‘https://’};

location.href = prot + frm.Server_Name.value + ‘/’ +frm.WebDBName.value + ‘/’ + frm.ViewName.value + ‘?OpenView&ExpandView&StartKey=’ + frm.SuchText.value

So I’m using StartKey as an parameter to jump to position in views that the user can define by putting the text in the field. Now I’d like to have the jump work when the user just hits the ENTER key after typing the word in the text field (search box) is there any way to accomplish this.

I hope I got my idea clear, if something is to hard to understand please ask.

Thanks for help and suggestions in advance & Greets,

Marco

Subject: Trigger a button with the ENTER key in an webapplication

function enterkey()

{

var e = window.event;

key = e.keyCode;

if(key == 13)

{

… ur code here

}

}

Subject: RE: Trigger a button with the ENTER key in an webapplication

Where should I put this? It has some HTML in it, hasn’t it?

Thanks for the very quick answer I’ll try for myself until you perhaps write back.

Greets,

Marco

Subject: RE: Trigger a button with the ENTER key in an webapplication

hi

in text field u have event called onkeypress put call tht js function into tht.

in jsheader put tht function hope ur clear now.

kavitha

Subject: RE: Trigger a button with the ENTER key in an webapplication

Yeah, it works, thanks for your help.

Greets,

Marco

Subject: Trigger a button with the ENTER key in an webapplication

perhaps you can write code to click the jump button in the “onKeyPress” event of the search field.

just say document.<*>…<button_name>.click()

-Shiva.

Subject: RE: Trigger a button with the ENTER key in an webapplication

Well, put onKeyPress would be triggered by any key, the problem was that I it is only allowed to be triggered by the enter key.

But thanks for your suggestion, too.

Marco

Subject: RE: Trigger a button with the ENTER key in an webapplication

hi

i have given the function which will allows to do operation for enter key alone

ascii of enter key 13 so function will fire only for enter hope ur getting me

kavitha