Flash Games
 FAQ   Search   Memberlist   Usergroups   Register  Profile   Log in to check your private messages   Log in 


to check the datatype of an argument passed in a function



 

Post new topic   Reply to topic  
   DEVPPL Forum Index -> JavaScript Forum
View previous topic :: View next topic  
Author Message
platinum



Joined: 31 Jan 2007
Posts: 2

PostPosted: Wed Jan 31, 2007 3:57 pm    Post subject: to check the datatype of an argument passed in a function Reply with quote

am trying to make a program in which thers a function which will take a single argument and then it will check the type of argument passed i.e whether it is an integer type or string or float and print the same.I tried making it and cud do it by using "on button click".but i am not getting how to to it without "button onclick".i just want to print the type of data passed without any button onclick.
can anyone here help me with it.heres what i did:

<html>
<head>
<script language="JavaScript">
function datatype()
{
}
function check(arg)
{
document.write(typeof(arg));
}
var data=new datatype();
</script>
</head>
<body>
<input type="button" onclick="(data)" value="Object">
<input type="button" onclick="check(5)" value="Number">
<input type="button" onclick="check('Hello')" value="String">

</body>
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DEVPPL Forum Index -> JavaScript Forum All times are GMT + 1 Hour
Page 1 of 1

 
 
Welcome to DEVPPL.com
You are not logged in, which means that you can't post in the forums.
Click here to Register

If you are a current member here on DEVPPL, please login below:

User: Pass:
Log me on automatically each visit:

 


Powered by phpBB © 2001, 2005 phpBB Group - Modified by DEVPPL

Flash Games - Sitemap