platinum
Joined: 31 Jan 2007 Posts: 2
|
Posted: Wed Jan 31, 2007 3:57 pm Post subject: to check the datatype of an argument passed in a function |
|
|
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> |
|