views:

72

answers:

2

i have coded a header file which contains a input textbox for search.this header is include in body tag of a jsp page as shown below.

<body>
<include src="header.ssi">
<form>
</form>

onclick of button i header file i am running a javascript function. i need to refer to this textbox in javascript function.

+2  A: 

document.getElementById — but it should be in a form

David Dorward
but textbox is not in form
Maddy.Shik
So? You don't need it to be in a form to use getElementById, that's why I said to use getElementById. Having a text input without a form means it isn't going to work unless JavaScript is available, which is why I said it **should** be in a form.
David Dorward
+1  A: 

If you can use jQuery then simply use $("#textboxid") to access the textbox

Ramesh Soni