Andrew wrote on 25 Nov 2003:
<snip>
<Script language="JavaScript">
You don't need to use the language attribute, but you *must* use the
type attribute. Change the above to:
<SCRIPT type="text/javascript">
<!--//hide
There is no need to hide SCRIPT element contents with SGML comments.
function AddDealer(dealer) {
document.adddealer.dealertoadd.value = dealer;
You don't say it, but it's clear that 'adddealer' is a form and
'dealertoadd' is a form control. It is better to use this syntax (it
works across more browsers):
document.forms['adddealer'].elements['dealertoadd'].value = dealer;
May I also suggest that you use hyphens (-), underscores (_), or
capitalisation to make your identifiers more readable. Be aware that
if you use hyphens, you must use the collection syntax (above) to
access the element, or it will be interpreted as the subtraction
operator.
document.adddealer.submit();
This can be changed, likewise:
document.forms['adddealer'].submit();
}
//-->
You can remove that.
</script>
This calls the Function;
<input type="button" value="Make This My Dealer"
onClick="AddDealer('<%=(iwDealerCode(x))%>');" name="button">
Please don't show server-side elements of your script. They mean
nothing to us. Instead, indicate what /would/ be there after an
interpreter has parsed it.
Couldn't you have found a better name for your button other than
'button'? Identifiers should have meaningful names. Something like
'button' can lead to the terrible habit of naming everything
'button1', 'button2', 'button3', etc.
The only other things to check (as you didn't show them here), is
that a form exists with the name, 'adddealer', and a control exists
with the name, 'dealertoadd'.
Hope that helps,
Mike
--
Michael Winter
M.******@blueyonder.co.uk.invalid (remove ".invalid" to reply)