[thelist] simple but baffling JS problem...

Warden, Matt mwarden at odyssey-design.com
Sun Feb 4 22:43:37 CST 2001


> <script language="JavaScript">
> <!--
> function updateValue(propName) {
> var hidey = 'parent.topFrame.document.form1';
> hidey.propName.value="true";
> }
> file://-->
> </script>
>
> is on the same page as the checkboxes, which look like this...
>
> <input type="checkbox" name="sugarcove" onclick="updateValue(self.name);">
>
>
> Naturally, the other form (which is just a series of inputs designed to do
> nothing more than store the values true pr false depending on which
> checkboxes are selected) is in the other frame.
>
> THE PROBLEM...
> When you click the checkbox, an error is generated that says 'propName is
> null or not an object'. But, as far as I can tell...it IS TOO an object!

No it's not... well... yes it is... but not the right object. It's a string.
Call it like this:


<input type="checkbox" name="sugarcove" onclick="updateValue(this);">

You have to pass reference to the object itself, not just it's name. Now,
change your fuction to this:


function updateValue(propName) {
    propName.value="true";
}


That should do it. Hope this helps.



--
mattwarden
mattwarden.com





More information about the thelist mailing list