JAvA script Phone Number Random

Download  For Use RANDOM PHONE NUMBER

It just a small and easy Code on java script and my code is not good at all.but please help me to correct it if anything wrong.






<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Number List</title>
<script>




function add()
{
if(document.getElementById("ad").value=='')
{
alert("Please, enter data here!")
document.getElementById("ad").focus();
}
else
{
 var oSelField=document.getElementById("selectField")
 var oOption=document.createElement("OPTION")
 oSelField.options.add(oOption)
 oOption.text=document.getElementById("ad").value
 oOption.value=document.getElementById("ad").value
 
}
}
function c(s)
{
var i;
for(i=s.options.length-1;i>=0;i--)
{
 s.remove(i);
 
}
document.frm.ee.value=" "
document.frm.txt.value=" "

}

function rd()
{
 //alert(document.frm.selname.length);
 var rnd=Math.floor(Math.random()*document.frm.selname.length);
 var y=document.frm.selname.options;
 document.frm.ee.value=(y[rnd].text)
 document.frm.selname.remove(y[rnd].indexs);

}


</script>
</head>

<body>
<form name="frm">
<table border=1>
<tr><td>Number List</td>
<td><select name=selname id="selectField"   style="width=150"></select></td>

<td><input type=button value=Random onclick="rd()"></td></tr>

<tr><td colspan=2 align=right><a>Type Here</a><input type=text id="ad" name=txt title="type here"></td>

<td><input type=button value=Add onclick="add()"><input type=button value=Delete onclick="c(selname)" ></td></tr>

<tr><td colspan=3><a>The Random Number is &nbsp</a><input type=text name=ee align=absmiddle></td></tr>
</table>
</form>
</body>

</html>

Comments

Popular Posts