It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming HTML Forum

to check the datatype of an argument passed in a function

to check the datatype of an argument passed in a function

Postby platinum on Wed Jan 31, 2007 12:37 pm

am trying to make a html program in which theres a function which will take a single argument and then it will be 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 hep 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>
</html>
platinum
 
Posts: 2
Joined: Wed Jan 31, 2007 12:17 pm

Who is online

Users browsing this forum: No registered users and 6 guests