command use : Math.random ( );
here are the example :
<html>
<body>
<script type="text/javascript">
var d = Math.random();
if(r<50)
{
document.write("you will see the value of random r is " + r);
}
else
{
document.write("you will see second chance the value of r is " + r)
}
</script>
</body>
</html>
on the above you can see that random value is created by function Math.random
the result may vary from that codes you can try it
its usually use to validating the form login or some other that need to validate the data by fiting the number defined by the funtion and the input text from the user , how it can? learn on next our post may be you want........
No comments:
Post a Comment