Nope,  I still get the error:  'the server threw an exception' (in MSIE
5.01).  The error usually proceeds to take the browser down with it.

It happens when I try to set the variable 'opts'.  Could I be setting up the
object variable (opts) incorrectly?  That's my guess, anyway.  I can read
'opts'

For example:

opts.length  (returns the length)
opts[1].text (returns the name of the first option in the list)

It's just when I try to make a 'new' one that it gets upset.


Bugger.

-----Original Message-----
From: Josh Petrin [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, March 28, 2000 1:46 PM
To: [EMAIL PROTECTED]
Subject: Re: Populating 'window.opener' select box


Try this:

<script language="JavaScript">
function add2options(optText,optVal){

        var opts;
        opts = window.opener.document.forms[0].list2.options;
        a = opts.length;
        opts[opts.length] = new Option
        opts[a].text = optText;
        opts[a].value = optVal;
}
</script>


>Hi list,
>
>Using javascript, I am trying to populate a select box from a window that I
>pop up (child window), but am receiving an error.
>
>Here is the offending function:
>
><script language="JavaScript">
>function add2options(optText,optVal)
>
>       var opts;
>       opts = window.opener.document.forms[0].list2.options;
>       opts[opts.length] = new Option(optText,optVal, 0, 0);
>}
></script>
>
>
>In the body of my pop-up page, I call the above function with something
>like:
>
><cfoutput>
><input type="checkbox" name="B2" value="Populate"
>onClick="javascript:add2options('#query.name#','query.#value#');">
></cfoutput>
>
>
>Does anyone know how to do this, or have an example that could help me?
>
>I would appreciate any help you can give me.
>
>TIA,
>
>
>
>     /_)
>   (8_))}-  .
>     \_)      '.
>        .--.    .  Chris Wells
>       :    '. .'  Enterprise Internet Solutions
>        '---'`;
>             .     Syntegra (USA), Inc.
>          _.'      [EMAIL PROTECTED]
>       .'          651/415-4087
>       '._
>           ` ' ' '   '  '
>
>---------------------------------------------------------------------------
---
>Archives: http://www.eGroups.com/list/cf-talk
>To Unsubscribe visit
>http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
>send a message to [EMAIL PROTECTED] with 'unsubscribe' in
>the body.


:: josh.petrin
:: applications.developer
:: cardinal.communications
:: [EMAIL PROTECTED]
:: 510.647.1400.x221
:: fax.510.647.1401
----------------------------------------------------------------------------
--
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to