Current location: Hot Scripts Forums » General Web Coding » JavaScript » JS works in all but Firefox for Mac...done lots of homework...


JS works in all but Firefox for Mac...done lots of homework...

Reply
  #1 (permalink)  
Old 12-08-08, 04:15 PM
Jayson44 Jayson44 is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
JS works in all but Firefox for Mac...done lots of homework...

hey everyone...I know this has been brought up on the web before (I've been researching all morning to try to find an answer) but I can't quite get it right in my particular case. I'm a designer and not a coder, and the code that I'm working with was done by someone else...I've just been given the task of fixing the problem.

the link is here >> http://www.medrec-pt.com/search/index.html, but you have to click through the first 3 sets of questions to get to where I'm having trouble. you'll come to a map that says to choose the states you're interested in. when you click on a state, it adds it to the list on the left. this seems to work fine in all browsers, both windows and mac, except for firefox on a mac. looking at the JS error console, I see it says

Quote:
Error: form_3 is not defined
Source File: javascript:addMapState(form_3.mystates,%20form_3,% 20'NEVADA')
Line: 1
I've gone into both the HTML file an the JS file to see what I could find. the only thing I could find that seemed suspisious to me (and being a designer, I really didn't know where to start, I just started digging around...) is in the JS file, all the other forms were called before their functions. for example:

HTML Code:
function process_screen_2() {
	var answer = '';
	var position = '';

	var form = document.getElementById('form_2');

	for (var i = 0; i < form.elements.length; i++) {
		if (form.elements[i].checked) {
			answer = form.elements[i].value + ' ';
			position = form.elements[i].value;
		}
	}

	var error = '';

	if (answer == '') {
		error = "Please select the type of position you are interested in.<br />";
	}

	if (error == '') {
		document.getElementById('screen_3_blank_1').innerHTML = answer;
		document.getElementById('screen_4_blank_1').innerHTML = answer;

		document.getElementById('screen_2').style.display = "none";
		document.getElementById('screen_3').style.display = "block";

		document.getElementById('position_answer').value = position;
	} else {
		document.getElementById('error_2').innerHTML = error;
	}

	return '';
}
however, I noticed that the next one (the form_3 that I was having errors with) did not have the line

HTML Code:
var form = document.getElementById('form_3');
so I added it, thinking that would solve the problem. but nothing changed. any suggestions? here's the code that I changed in the JS file:

HTML Code:
function process_screen_3() {
	var answer = '';
	var city_input = '<table>';
	
	var form = document.getElementById('form_3');

	var states = document.getElementById('mystates');

	var count = 0;

	for (var i = 0; i < states.options.length; i++) {
		if (count > 0) {
			answer += ', ';
		}
		var state = capitalize(states.options[i].value);
		answer += state;

		city_input += '<tr><td>' + state;
		city_input += '<input type="hidden" name="STATE_' + i + '"';
		city_input += ' id="STATE_' + i +'" value="' + state + '" />' + '</td>';
		city_input += '<td><input name="' + i + '" type="text" size="40" /></td></tr>';

		count++;
	}

	city_input += '</table>';

	if (count > 1) {
		answer = replace_last_comma(answer);
	}

	var error = '';

	if (count == 0) {
		error = "Please select where you want to work.<br />";
	}

	if (error == '') {
		document.getElementById('screen_3b_blank_1').innerHTML = city_input;

		document.getElementById('screen_3').style.display = "none";
		document.getElementById('screen_3b').style.display = "block";
	} else {
		document.getElementById('error_3').innerHTML = error;
	}

	return '';
}
J.
Reply With Quote
  #2 (permalink)  
Old 12-08-08, 06:35 PM
DAL's Avatar
DAL DAL is offline
Code Master
 
Join Date: Jun 2003
Location: North East England/UK
Posts: 874
Thanks: 0
Thanked 0 Times in 0 Posts
"Click for next page" doesn't work from the first page of that link - I can't get to the page your on about.
__________________
"once upon a midnight dreary, while i pron surfed, weak and weary, over many a strange and spurious site of 'hot xxx galore'. While i clicked my fav'rite bookmark, suddenly there came a warning, and my heart was filled with mourning, mourning for my dear amour," 'Tis not possible!", i muttered, "give me back my free hardcore!" quoth the server, 404."
Reply With Quote
  #3 (permalink)  
Old 12-09-08, 03:57 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Error in Firefox is:

Code:
Error: form_3 is not defined
Source File: javascript:addMapState(form_3.mystates,%20form_3,%20'CALIFORNIA')
Line: 1
Firfox seems to render
Code:
%20
in the function call. This migth cause the problem. Try to change code from

Code:
 javascript:addMapState(form_3.mystates,%20form_3,%20'CALIFORNIA')
to

Code:
 javascript:addMapState(form_3.mystates,form_3,'CALIFORNIA')
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish

Last edited by Yeroon; 12-09-08 at 04:17 AM.
Reply With Quote
  #4 (permalink)  
Old 12-09-08, 04:37 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Found the actual problem:

Use this:

Code:
<AREA SHAPE="POLY" COORDS="48,96,38,126,76,190,68,213,44,207,17,175,3,113,12,81" href="javascript:addMapState(document.forms.form_3.mystates,document.forms.form_3,'CALIFORNIA')">
For the image map href tags. It then works in FF too.
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
  #5 (permalink)  
Old 12-09-08, 08:44 AM
Jayson44 Jayson44 is offline
Newbie Coder
 
Join Date: Dec 2008
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Quote:
Originally Posted by Yeroon View Post
Found the actual problem:

Use this:

Code:
<AREA SHAPE="POLY" COORDS="48,96,38,126,76,190,68,213,44,207,17,175,3,113,12,81" href="javascript:addMapState(document.forms.form_3.mystates,document.forms.form_3,'CALIFORNIA')">
For the image map href tags. It then works in FF too.
thank you so much, yeroon. this worked perfectly.

J.
Reply With Quote
  #6 (permalink)  
Old 12-09-08, 08:58 AM
Yeroon's Avatar
Yeroon Yeroon is offline
Code Master
 
Join Date: Aug 2007
Location: Netherlands, Nijmegen
Posts: 850
Thanks: 2
Thanked 20 Times in 20 Posts
Glad it did

Dont forget to mark as SOLVED (top of this topic in thread tools menu)
__________________
Feel free to thank people if they help you by clicking thanks at a post.
=================================
Make it idiot proof and someone will make a better idiot.
=================================
Realise the impotence of proof reading everything you publish
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Image replace works in IE - not FireFox patter JavaScript 4 09-23-07 07:41 PM
page works in firefox but not IE aburrows182 HTML/XHTML/XML 2 04-29-07 06:39 PM
Problem with JS in IE/ Firefox djnaf JavaScript 5 11-07-06 06:42 AM
AJAX works in IE not in firefox srustiranjan JavaScript 1 06-04-06 08:32 AM
Problem js on firefox ivan JavaScript 1 05-22-06 08:09 PM


All times are GMT -5. The time now is 11:45 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.