add option on another page

Javascript coding ..

Moderators: macek, egami, gesf

*JaH*
New php-forum User
New php-forum User
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm

add option on another page

Postby *JaH* » Sun Apr 13, 2003 11:38 am

Hi does anyone know if it's forbidden to add an option in a list on another page? I think it is but maybe I am doing something wrong:

Code: Select all

function setOption(ip,status) {
  var elemID = 'ip_usr';
  var length = window.opener.document.forms.form1.ip_usr.length;
  var optionName = new Option(ip, status);
  window.opener.document.all(elemID).options[length] = optionName;
  window.opener.document.forms.form1.ip_usr.options[length] = optionName;   
  window.opener.document.getElementById(elemID).options[length] = optionName;   
  window.opener.document.layers[elemID].options[length] = optionName;
}


neither of the last lines work...they all give me the error:
The server threw an exception

so, could anyone confirm me that it is forbidden to add an option on another page? :)

*JaH*
New php-forum User
New php-forum User
Posts: 80
Joined: Fri Jan 31, 2003 4:18 pm

Postby *JaH* » Mon Apr 14, 2003 4:24 am

hmmm found the answer. It's just not supported yet:


Code: Select all

Note: This works in Netscape 4.x and 6.x but NOT IE 5.x
IE 5.x reports:
   'The server threw an exception'
Script debugger points to the line that the option., i.e.,
   sel.option[sel.options.length] = opt;
Further details:
   'An exception of type "Microsoft JScript runtime error: Object
    doesn't support this property or method" was not handled.'


Return to “JavaScript”

Who is online

Users browsing this forum: No registered users and 1 guest