I'm trying to use the DIV tag instead of the FORM tag which I'm currently using in my code to create a 'drop down list'. But I'm getting the ERROR: 'document.drop_ list.locationID ' is null or not an object.
How can I make the FORM tag to a DIV tag in the code below? What other changes do I need to do?:
[code=javascript]
<html>
<head>
<script>
function addOption(selec tbox,text,value )
{
var optn = document.create Element("OPTION ");
optn.text = text;
optn.value = value;
selectbox.optio ns.add(optn);
}
</script>
</head>
<body onLoad="addOpti on_list()";>
<FORM name="drop_list ">
Location:
<SELECT NAME id="locationID" >
<option>--Location--</option></SELECT>
</FORM>
<script>
function addOption_list( )
{
var locate = new Array("England" , "Wales", "Scotland", "Ireland");
for (var i=0; i < locate.length;+ +i){
addOption(docum ent.drop_list.l ocationID, locate[i], locate[i]);
}
}
</script>
<br></br>
</body>
</html>[/code]
How can I make the FORM tag to a DIV tag in the code below? What other changes do I need to do?:
[code=javascript]
<html>
<head>
<script>
function addOption(selec tbox,text,value )
{
var optn = document.create Element("OPTION ");
optn.text = text;
optn.value = value;
selectbox.optio ns.add(optn);
}
</script>
</head>
<body onLoad="addOpti on_list()";>
<FORM name="drop_list ">
Location:
<SELECT NAME id="locationID" >
<option>--Location--</option></SELECT>
</FORM>
<script>
function addOption_list( )
{
var locate = new Array("England" , "Wales", "Scotland", "Ireland");
for (var i=0; i < locate.length;+ +i){
addOption(docum ent.drop_list.l ocationID, locate[i], locate[i]);
}
}
</script>
<br></br>
</body>
</html>[/code]
Comment