Suppose i have a requirement to accept my textbox with integers range between minimum & maximum limits. How can i achieve it?
Here is the solution using Java Script.
Here is the solution using Java Script.
<script type="text/javascript">
function minmax(value, min, max)
{
if(parseInt(value)
< 0 || isNaN(value))
return 0;
else if(parseInt(value)
> 100)
return 100;
else return
value;
}
</script>
<input type="text" name="textWeight"
id="txtWeight" maxlength="5" onkeyup="this.value =
minmax(this.value, 0, 100)"/>
|
No comments:
Post a Comment