B
Bruce W.1
This is my first javascript effort and it's not going well so far.
Guess it's not so easy after all.
I want a text box to be populated with some text when I push a button.
Simple yes? It just isn't working for me though. I'm testing in
Dreamweaver's preview IE browser window.
The code is below. Can anyone tell me what's wrong? Thanks for your help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<script type="text/javascript">
function fill(form) {
form.SubmitButton.value = "hello world";
}
</script>
<body>
<form name="form1" method="post" action="">
<p>
<input type="text" name="textfield">
</p>
<p>
<input type="submit" name="SubmitButton" value="Submit"
onClick="fill(this.form1)">
</p>
<p> </p>
</form>
</body>
</html>
Guess it's not so easy after all.
I want a text box to be populated with some text when I push a button.
Simple yes? It just isn't working for me though. I'm testing in
Dreamweaver's preview IE browser window.
The code is below. Can anyone tell me what's wrong? Thanks for your help.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<script type="text/javascript">
function fill(form) {
form.SubmitButton.value = "hello world";
}
</script>
<body>
<form name="form1" method="post" action="">
<p>
<input type="text" name="textfield">
</p>
<p>
<input type="submit" name="SubmitButton" value="Submit"
onClick="fill(this.form1)">
</p>
<p> </p>
</form>
</body>
</html>