<% String[] abc={'saab',' volvo',"bmw","Benz","Porsche","Jaguar"}; %><script language="Javascript">var jsArr = new Array(); <% for (int i=0; i < abc.length; i++) { %> jsArr[<%= i %>] = '<%=abc[i] %>'; //Here is the latest update check it sravan .Put single quotes.<%}%> </script> function myFunction() { var select = document.getElementById("dropDownId"); for ( var i = 0; i < jsArr.length; i++ ){ var option = document.createElement("option"); // set the text that displays for the option option.innerHTML = status[i]; // add the option to your select dropdown select.appendChild(option); }