Forum Moderators: open

Message Too Old, No Replies

form error with firefox

         

superbman

10:58 pm on Jul 19, 2005 (gmt 0)

10+ Year Member



hey guys, new to this place but i see that you have a really good community here that tends to help each other out. Was hoping to get in on it. I have a pretty annoying problem where my javascript to check the input of a form refuses to work on a website that's already been designed (i'm just debugging). here's the errant code:
"<BODY bottomMargin=0 leftMargin=0 rightMargin=0 BGCOLOR="#FFFFFF" TEXT="#000080">
<SCRIPT TYPE="text/javascript">
<!--

function checkInput() {
var authors = "";
var middlename = "";
var lastname = "";

var option1 = getObject("option1");
var option2 = getObject("option2");
var option3 = getObject("option3");
var option4 = getObject("option4");
var option5 = getObject("option5");
var option6 = getObject("option6");
var option7 = getObject("option7");
var option8 = getObject("option8");
var option9 = getObject("option9");
var optionR = getObject("optionR");
var optionO = getObject("optionO");
var boxchecked = 0;
var category_list = '';
var current_category = '';
if (option1.checked ) {
boxchecked = 1;
category_list = 'NLP and Ontologies in Biomedicine';
}
if (option2.checked) {
boxchecked = 1;
current_category = 'Information Extraction in Biomedicine';
if (category_list == '') {
category_list = current_category;
} else {
category_list = category_list + ',' + current_category;
}
}
..."
with this code going on like this for a bit.
the error is on the line that is italicized. here is the error:
Error: option1 has no properties
Source File: file:///e:/www/dataentry.html
Line: 29

why is it doing this and how can i get around this? It seems to work fine in IE, but firefox refuses to run this script.
Lemme know if you guys need me to post up all the code, there's just a lot.
Thanks a lot for anyone that can help!
Anirudh

superbman

12:00 am on Jul 20, 2005 (gmt 0)

10+ Year Member



oh, and later on in the code, there is this function:
"function getObject(Name) {
if (document.all) {
return document.all[Name];
} else if (document.getElementById) {
return document.getElementById(Name);
} else if (document.layers) {
return eval("document.entryform."+Name);
}
return false;
}"

now, i realise that document.all does not work for firefox now but how do i change this to 'modernize' this code?
as you can tell, i'm quite new at javascript (as in started today).

Birdman

12:00 pm on Jul 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I believe getObject() is a built-in JS function. I would try renaming the function and see if it helps. The function itself looks OK.

superbman

2:28 pm on Jul 26, 2005 (gmt 0)

10+ Year Member


it worked!
thanks so much! :D:D