javascript error while selecting select option...
Hi developers,
I am new to javascript. Now i am developing Application form. In my form when i am selecting country in sleect box then automatically load states in states select box.
This is my code...
<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">
function sele()
{
var con = document.frm.country.value;
var ap =new Array("Andhrapradesh","Tamilnadu","Karnataka","Kerala","Goa","Delhi");
ap.sort();
if(con =="1")
{
for(int k =0;k<ap.length;k++)
{
document.frm.state.options[k].text=ap[k];
}
}
}
></script>
</head>
<body>
<form action="regist.jsp" method="post" name="frm">
Country <select name="country" onchange="sele()">
<option>Choose</option>
<option value="1">India</option>
</select>
State <select name="state">
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
<option></option>
</select>
</form>
</body>
</html>
with Regards
sure...:)-

