add value to dropdown list
Posted: Sat Jan 08, 2011 12:59 am
hi friends,,,,,
i want add text box value ahen i am click create button,,,here is my code,,,,but it not working ,,wat s the problem
i want add text box value ahen i am click create button,,,here is my code,,,,but it not working ,,wat s the problem
Code: Select all
<html>
<head>
<title>Group mail</title>
<script language=javascript>
function add()
{
var str=document.frm.lina.value;
alert(str);
var optn = document.createElement("OPTION");
optn.text = document.frm.lina.value;
alert(optn.value);
getElementByid('sel').options.add(optn);
}
</script>
</head>
<body>
<div id=d style="position:absolute;left:300px;top:200px">
<form name=frm>
Enter the List Name <br>you want to Create : <input type=text name=lina style="position:absolute;left:140px;top:16px"> <br>
<select name=sel id=sel style="position:absolute;left:300px;top:16px">
<option>None</option>
</selet>
<input type=button value=Create name=cre onClick="add();" style="position:absolute;left:170px;top:60px">
</form>
</div>
</body>
</html>