tags:

views:

49

answers:

1

hi

i am using jsp, in that one i used search box with 'id' i want to read that id to javascript file... but document.getelementbyid() is not working...

A: 

Java/JSP runs at server machine and produces a HTML/CSS/JS page. Javascript runs at the client side and knows nothing about Java/JSP/whatever code which runs at the server side. Open the page in webbrowser, rightclick and choose View Source. You see, no single line of Java/JSP code (if it has done its job right). Also see this article.

Your problem is more in the Javascript/HTML corner. Since it's unclear what exactly you mean with "not working" (you're more talking in end-user perspective than in real developer's perspective), I suggest to get yourself through some basic tutorials first to get the concepts and the basic terminology right so that you can ask better questions here. There are decent basic tutorials/references at w3schools.com: Javascript and HTML DOM.

BalusC
you're so kind, @BalusC
Pointy
hi, input type="text" name = "keyword" id="keyword" class="textInput" this is my jsp pageand the my js file is var keyword = document.getElementById("keyword")i am not getting the keyword in the js file
murali
Maybe you're getting it at the wrong moment, before the DOM is loaded. You'll really need to show some code in flavor of an [SSCCE](http://sscce.org).
BalusC