Search This Blog

Thursday, December 22, 2011

passing javascript value to scriplet tag

<html>
<script>
function selectValue()
{
var myChoice = document.form.bikeBrand.options[document.form.bikeBrand.selectedIndex].text;
window.location.replace("passValue.jsp?value="+myChoice);
}
</script>
<form name="form" >
<select name="brand" id="bikeBrand" onchange="selectValue();">             
<option value="<-Select->"><- Select- ></option>             
<option value="Honda">Honda</option>             
<option value="TVS">TVS</option>             
<option value="Bajaj">Bajaj</option>             
</select>           
</form> 
         
<% String str=request.getParameter("value");           
if(str!=null)          
out.println("Selected value is="+str);            
%>
</html>

No comments:

Post a Comment