473,385 Members | 1,958 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Form elements work in Firefox, but not in I.E.

OK. I'm very new to Javascript and what I've learned so far has been find snippets of code on the web and using them in my php programs. I put together an application that allows a Reset button to clear radio inputs in a portion of the page. And another button which will also set the values of these same radio's to a certain value. The form is for evaluating a speaker at a conference.

I programmed everything using Firefox for testing and my client tested with Safari and everything was working great. Then a user goes and tried Internet Explorer. Whoops, wont work. Can anyone explain why this snippet wont work in I.E.?

Expand|Select|Wrap|Line Numbers
  1. function reset_session(radioObj1, radioObj2, radioObj3, radioObj4, radioObj5, radioObj6 ) {
  2.         for(var i = 0; i < 4 ; i++) 
  3.             radioObj1[i].checked = false;
  4.         for(var i = 0; i < 4 ; i++) 
  5.             radioObj2[i].checked = false;
  6.         for(var i = 0; i < 4 ; i++) 
  7.             radioObj3[i].checked = false;
  8.         for(var i = 0; i < 2 ; i++) 
  9.             radioObj4[i].checked = false;
  10.         for(var i = 0; i < 2 ; i++) 
  11.             radioObj5[i].checked = false;
  12.         for(var i = 0; i < 2 ; i++) 
  13.             radioObj6[i].checked = false;
  14.         }
  15.         //-->
  16.     </script>
  17.     <script type='text/javascript'>
  18.         <!--
  19. function setCheckedValue(radioObj1, radioObj2, radioObj3, radioObj4, radioObj5, radioObj6 ) {
  20.         radioObj1[0].checked = true;
  21.         radioObj2[0].checked = true;
  22.         radioObj3[0].checked = true;
  23.         radioObj4[0].checked = true;
  24.         radioObj5[0].checked = true;
  25.         radioObj6[0].checked = true;
  26.         }
  27.         //-->
  28.     </script>
  29.  
And the php generated html page:
[HTML]<input type='button' name='reset' value='Reset' onclick="reset_session(document.forms['mainform'].elements['7451_1_1'], document.forms['mainform'].elements['7451_1_2'], document.forms['mainform'].elements['7451_1_3'], document.forms['mainform'].elements['7451_1_4'], document.forms['mainform'].elements['7451_1_5'], document.forms['mainform'].elements['7451_1_6'])" /><input type='button' name='rate' value='Rate this session Excellent' onclick="setCheckedValue(document.forms['mainform'].elements['7451_1_1'], document.forms['mainform'].elements['7451_1_2'], document.forms['mainform'].elements['7451_1_3'], document.forms['mainform'].elements['7451_1_4'], document.forms['mainform'].elements['7451_1_5'], document.forms['mainform'].elements['7451_1_6'], 4, 7451, 1 )" />
[/HTML]
Thanks for any help...

Mark.
Aug 26 '07 #1
4 2124
dmjpro
2,476 2GB
Welcome to TSDN.
It ll be better to give the total HTML file so that we can figure out the elements of the form.
OK.
So as early as possible send us that HTML code.
OK.

Kind regards,
Dmjpro.
Aug 27 '07 #2
acoder
16,027 Expert Mod 8TB
setCheckedValue only has 6 parameters. You've given 9.

You should also avoid using a number as the beginning of a form element name.
Aug 27 '07 #3
Thanks very much for looking at my question. I was able to figure a working model by accessing the page elements in sequence as opposed to trying to pass the element names as a variable.

Thanks again,
M.
Aug 28 '07 #4
acoder
16,027 Expert Mod 8TB
Thanks very much for looking at my question. I was able to figure a working model by accessing the page elements in sequence as opposed to trying to pass the element names as a variable.
Actually that's a good idea. Passing the element names is fine, but the way it was done in this situation wasn't the best way.
Aug 29 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Forti2ude | last post by:
Hello, I have a simple form... <form> <select name="foo" multiple> <option value="1">one</option> <option value="2">two</option> <option value="3">three</option> </select>
3
by: Pavils Jurjans | last post by:
Hello, I have bumped upon this problem: I do some client-side form processing with JavaScript, and for this I loop over all the forms in the document. In order to identify them, I read their...
4
by: Stuart Perryman | last post by:
Hi, I have the following code which works just fine in IE6 but not in Firefox. It is an extract of several table rows each with an individual form. It is generated by php. <form...
35
by: Aaron Gray | last post by:
Hi, I have some code I just cannot seem to get to work properly on FireFox. It is probably something simple. On FireFox the following code does not seem to terminate in the browser, but it...
2
by: lasher168 | last post by:
Hi, I have a problem which I have been on pondering all day and wasting time !!! I have a javascript call which looks like this <td width="50%" class="inputLabel"><span...
11
by: shankwheat | last post by:
I have a function which passes text from txtdebt to debtsbox which works fine. However, I want to add code which examines the value of debtsbox and if any of the values the user entered contain the...
18
by: Diogenes | last post by:
Hi All; I, like others, have been frustrated with designing forms that look and flow the same in both IE and Firefox. They simply did not scale the same. I have discovered, to my chagrin,...
3
by: judy.j.miller | last post by:
Does anyone know why i can't access a form element value using dot notation in firefox, when i'm in a function. Works ok in the body. I'm trying to do this: var FarTemp = faren.temp.value; I...
11
by: dhtml | last post by:
(originally mis-posted on m.p.s.jscript...) I've just closed all windows in Firefox and its using 244MB of memory. I have no idea why. I had GMail open, a page from unicode, the CLJ FAQ. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.