...

View Full Version : eval problem



katib
10-16-2006, 02:53 PM
Hi

I need to loop trhrough a dynamic number of select boxes in javascript

for (i = 1; i <= iCount; i++)
{
var anOption = Evalwindow.opener.document.createElement("OPTION");
eval("window.opener.document.frmAdd.drpClient" + i + ".options.add(anOption)");

}

I'm getting the following error: 'Evalwindow' is undefined
Anyone can help me sort it out?

Thanks

Kati

Kor
10-16-2006, 03:33 PM
avoid eval(). What in fact you wanna do? can u detail your problem?

felgall
10-16-2006, 11:14 PM
var anOption = Evalwindow.opener.document.createElement("OPTION");

I'm getting the following error: 'Evalwindow' is undefined
Anyone can help me sort it out?

So you forgot to define Evalwindow. In order for that statement to work you need to change the window.open() statement to read:


var Evalwindow = window.open(......

or better just change the statement to:


var anOption = document.createElement("OPTION");

provided the current page is the one that opened the popup.



Also you can change:


eval("window.opener.document.frmAdd.drpClient" + i + ".options.add(anOption)");


and get rid of the eval() by coding it like this:


window.opener.document.frmAdd["drpClient" + i ].options.add(anOption);



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum