It depends on how you're calling the function. Either way, you have to pass the variable into the function in order for the function to know your value.
Somewhat similar to this:
<script type="text/javascript">
// this parameter can be named whatever
function limitVisitors(param1) {
if ( param1 > 60 ) {
alert("We can only accommodate 60 people on a group visit. You entered " + param1 + " visitors.");
}
}
// Just make sure that this value gets passed to the function like this
var visitors = document.getElementById('tb254597').value;
limitVisitors(visitors);
</script>
And you may want to consider jQuery so that you can use the $(document).ready() function in order to run when the DOM actually loads. If you're going to allow for user input, you may want to have a event binding like a button click.
EDIT:
Since you're using onchange in your HTML element, this should be all you need. Note the change in the function call:
<input type="text" name="Field_Number_of_visitors" size="20" id="tb254597" onchange="limitVisitors(this.value);" />
<script type="text/javascript">
// this parameter can be named whatever
function limitVisitors(param1) {
if ( param1 > 60 ) {
alert("We can only accommodate 60 people on a group visit. You entered " + param1 + " visitors.");
}
}
</script>
bodyends, also, make sure you've an element with that idbodytab. Here's the input element:<input type="text" name="Field_Number_of_visitors" size="20" id="tb254597" onchange="limitVisitors(this);" />