Page 1 of 1

javascript prob

Posted: Sat Jun 26, 2004 6:18 am
by mm00re
hey to all,

can someone please tell me y this simple script doesnt work:

js console error is;

Code: Select all

Error: window.opener.document.elem has no properties

Code: Select all

function click(colour){		
		  var loc = window.location;
			var arr = new Array();
			arr = loc.toString().split('?');
			elem = arrї1];
			window.opener.document.elem.value = colour;
			window.close();	  
		}
called with

Code: Select all

window.open('../settings/colour_picker.html?colours_form.error_back', 'colour_pop', 'width=300, height=215', '')
here, colours_form is the form name and error_back is a text field

it all works fine if i put this directly into code

also tried to eval the line: eval(window.opener.document.elem.value) = colour;

and still didnt work




many thanx

g00fy

Posted: Sat Jun 26, 2004 9:36 am
by feyd
try:

Code: Select all

eval('window.opener.document.'+elem+' = colour');

Posted: Sun Jun 27, 2004 4:43 am
by mm00re
thank you :D

Code: Select all

function click(colour){		
		  
			var loc = window.location;
			
			var arr = new Array();
			arr = loc.toString().split('?');
			
			var elem = arrї1];	
			eval('window.opener.document.'+elem+'.value = colour');
			
			window.close();	  
		}

kind regards,

g00fy