Joined: Tue Mar 27, 2007 10:55 pm Posts: 2279 Location: Earth Has thanked: 39 time Have thanks: 61 time
On focus clear text field content and pass parameter to function .
Code:
<html> <title>Pass parameter </title> <head> <script language="JavaScript" type="text/javascript"> <!-- function passParameter(age){ document.getElementById('output').innerHTML ="Your age is "+ age +" !"; alert("Your age is "+ age +" !";); } //--> </script>
</head>
<body>
<div id="output">Print age here</div> <form name="ageForm"> <input type="text" name="age" value="Please enter your age" onfocus="document.ageForm.age.value=''"> <input type="button" onclick="passParameter(document.ageForm.age.value)" value="Submit"> </form>
</body> </HTML>
_________________ Currenlty programming with : java , html , php , and javascript . (OCJP-6 certified )