P
Patrick Nolan
I've been developing a web page at work, testing it with Windows
Firefox and IE. Last night I tried it on my Mac at home, which
has four different browsers. Firefox and Camino worked just
fine. Mac IE had problems, but I have decided to ignore that
for a while. There were big troubles with Safari 1.3.2.
Basically none of my event handlers would work. They all got
the error message "does not allow calls". After some
googling I saw that this probably comes from a parse error
in one function. I've stared at the function and even changed
a few things, but I can't figure out what's wrong.
Here's the function, with the location of the parse error
indicated:
function submitIt() {
var title = document.forms[0].title.value;
if (title == "New title" || title == "") {
alert("You must specify a title.");
return false;
}
if (document.forms[0].authorx.length == 0) {
alert("You must specify at least one contact author.");
return(false);
}
if (document.forms[0].scigroup.value == "none") {
alert("You must choose one of the Science Groups.");
return(false);
}
selectAll(document.forms[0].authorx);
selectAll(document.forms[0].reviewersx); // Error here
selectAll(document.forms[0].eligibles);
return(true);
}
I thought it might have something to do with a reserved word,
so I changed the original "author, reviewers" to "authorx,
reviewersx". No luck.
This function is the onSubmit event handler for my form.
The elements authorx, reviewersx and eligibles are all
Select elements. The function selectAll looks like this:
function selectAll(theSelect) {
var i;
for (i=0; i<theSelect.length; i++)
theSelect.options.selected = true;
}
Firefox and IE. Last night I tried it on my Mac at home, which
has four different browsers. Firefox and Camino worked just
fine. Mac IE had problems, but I have decided to ignore that
for a while. There were big troubles with Safari 1.3.2.
Basically none of my event handlers would work. They all got
the error message "does not allow calls". After some
googling I saw that this probably comes from a parse error
in one function. I've stared at the function and even changed
a few things, but I can't figure out what's wrong.
Here's the function, with the location of the parse error
indicated:
function submitIt() {
var title = document.forms[0].title.value;
if (title == "New title" || title == "") {
alert("You must specify a title.");
return false;
}
if (document.forms[0].authorx.length == 0) {
alert("You must specify at least one contact author.");
return(false);
}
if (document.forms[0].scigroup.value == "none") {
alert("You must choose one of the Science Groups.");
return(false);
}
selectAll(document.forms[0].authorx);
selectAll(document.forms[0].reviewersx); // Error here
selectAll(document.forms[0].eligibles);
return(true);
}
I thought it might have something to do with a reserved word,
so I changed the original "author, reviewers" to "authorx,
reviewersx". No luck.
This function is the onSubmit event handler for my form.
The elements authorx, reviewersx and eligibles are all
Select elements. The function selectAll looks like this:
function selectAll(theSelect) {
var i;
for (i=0; i<theSelect.length; i++)
theSelect.options.selected = true;
}