Welcome visitor
* Login
* Register
It is currently September 20th, 2019, 1:44 pm
All times are UTC [ DST ]
* Search
View unanswered posts - View active topics

FORUMS » Client Side » JavaScript



Post new topic Reply to topic  [ 2 posts ] 
Author Message
  Evaluate Input Value
PostPosted: September 7th, 2009, 3:59 pm 

Posts: 23
How could i evaluate if the user entered a value in an input, and if there is a value that it is a number. Do you know how to go around this?


Top
 Profile  
 
  Re: Evaluate Input Value
PostPosted: September 7th, 2009, 5:17 pm 
User avatar

Posts: 71
<script type="text/javascript">
function eval(x){
if (!x){alert('enter a value');}
else if (isNaN(x)==true){alert('enter a number');}
else {alert('good');}
}
</script>

<input id="field" />
<input type="button" value="Evaluate" onclick="eval(document.getElementById('field').value);">


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

FORUMS » Client Side » JavaScript


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron