[Javascript] Help: code doesn't work in IE: thanks
Ben Curtis
Quixote at LaMancha.org
Fri Jul 20 13:55:56 CDT 2001
> function something (formName, selectName, toggleName)
> {
> // formName, selectName, toggleName containts something
> var selectObj = document.eval(formName).eval(selectName);
> var toggleObj = document.eval(formName).eval(toggleName);
> }
Use the already existing "forms" and "elements" arrays for this:
var selectObj = document.forms[formName].elements[selectName];
var toggleObj = document.forms[formName].elements[toggleName];
You will want to avoid using "eval" when there is a built-in alternative,
because each time you call "eval" it requires the Javascript compiler to
load and compile the string you pass before evaluating it -- and this will
slow down your code if you do it too much.
--
+Ben Curtis
...leveraging synergy right out of the box.
More information about the Javascript
mailing list