The
easiest way is to identify the inputs rather than name them:
<html>
<body>
<script language="javascript">
function Function1() { document.getElementById('TextBox').value = "You clicked the first button.";}
function Function2() { document.getElementById('TextBox').value = "You clicked the second button.";}
</script>
<input type="text" id="TextBox" name="TextBox" value="This is the text box."><br>
<input type="button" name="Button1" value="Button 1" onClick="Function1();">
<input type="button" name="Button2" value="Button 2" onClick="Function2();">
</body>
</html>
Those 'id' attributes have got to be unique.
There are other ways to get at objects that aren't id'ed; see this page:
http://www.pageresource.com/dhtml/ryan/part4-2.html
Moderator
Featured Poster
Reputation Points: 522
Solved Threads: 64
Veteran Poster
Offline 1,091 posts
since Jul 2006