[thelist] changing submit button value with javascript

Dan Parry dan at virtuawebtech.co.uk
Tue Jul 31 22:40:59 CDT 2007


> -----Original Message-----
> From: thelist-bounces at lists.evolt.org [mailto:thelist-
> bounces at lists.evolt.org] On Behalf Of Joel D Canfield
> Sent: 01 August 2007 02:18
> To: thelist at lists.evolt.org
> Subject: Re: [thelist] changing submit button value with javascript
> 
> > toggleValue('submit0',this,'Save','Del');
> >
> > When you check clickedID in the function it finds the string
> > 'delasset0'
> > which it then evaluates the method 'checked', which never
> > exists so will always be false
> 
> well, you were right, Dan. I'm puzzled about why 'submit0' has to be
> passed as a string (or I get an error) but delasset0 *can't* be passed
> as a string. seems like we're dealing with what's an object, and when,
> but I don't get it.

It's because in the function you call document.getElementById() which
accepts a string argument to return an object (in this case the submit
button)... If you wanted to use the object directly in the function your
function call would be:

toggleValue(document.getElementById('submit0'),this,'Save','Del');

Then you could use toggleID.value in your function

Not a great explanation but maybe it'll help a bit :)

Dan




More information about the thelist mailing list