rachelason
Programmer
Hi! i am trying to get a value of a textbox from a javascript file and then display it. It's a simple program i am testing because i have a bigger problem.
my code is
<html>
<head>
<title>index</title>
<script language="javascript" src="c.js" type="text/javascript">
</script>
</head>
<body>
<form name="myform" >
<input type="text" name="mytext" size="20" >
<input type="button" value="Show" onClick="javascript:sayHello('mytext');">
</form>
</body>
</html>
and the javascript file is
function sayHello(text1){
var temp1=document.getElementById(text1).value;
document.write(temp1);
}
I can't make the javascript file to pickup the value from the textbox....
Can someone correct my mistake? Thanks
my code is
<html>
<head>
<title>index</title>
<script language="javascript" src="c.js" type="text/javascript">
</script>
</head>
<body>
<form name="myform" >
<input type="text" name="mytext" size="20" >
<input type="button" value="Show" onClick="javascript:sayHello('mytext');">
</form>
</body>
</html>
and the javascript file is
function sayHello(text1){
var temp1=document.getElementById(text1).value;
document.write(temp1);
}
I can't make the javascript file to pickup the value from the textbox....
Can someone correct my mistake? Thanks