Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

passing javascript event to JSP code

Status
Not open for further replies.
Dec 14, 2000
4
0
0
US
I have a javascript function that opens a different page depending upon user selection from a combo box. I want to capture the result of that function in a string.

e.g.

<select name=&quot;abc&quot; onchange=&quot;JavaScript:ChoiceSelection(options[options.selectedIndex].value);&quot;>

<option value=&quot;x&quot;>x
<option value=&quot;y&quot;>y
<option value=&quot;z&quot;>z
</select>

Now, want the selected value (x,y,or z) in a string. In other words, i want the result of function ChoiceSelection.

<% String something = request.getParameter(???) %>
 
<script language=&quot;javascript&quot;>
function ChoiceSelection( sLetter){
if('undefined' == typeof(sLetter)) sLetter = &quot;x&quot;;
document.location = &quot;mypage.jsp?foo=&quot; + sLetter;
}
</script>

<% String something = request.getParameter(&quot;foo&quot;) %>

Hope this helps
-pete
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top