473,320 Members | 1,572 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,320 software developers and data experts.

firefox not detecting the form elements

omerbutt
638 512MB
hi i am making a intranet online test application for a school and for that i have to make a form for creating the test the logic is to select a subject and then the number of questions for that test initially there are only 2 select elements in the form namely the ,
subjects and the totalQuestions
when it selects the choice in the totalQuestions dropdown
it calls an onchange function makeAnswere(choice,rowId) which checks if the choice is,
1.multiple choice question
2.true/false
3.yes/no

if it is multiple choice then it creates a select element on run time by using
Expand|Select|Wrap|Line Numbers
  1. document.createElement()
and set all the attributes along with an onchange funtion but the problem is that the internet explorer detects that there are new elements but the firefox does not here is the code
Expand|Select|Wrap|Line Numbers
  1. function makeAnswere(choice,rowId){
  2.     if(choice=="MC"){
  3.         clrAns(rowId);
  4.         var Inp=document.createElement("select");
  5.         Inp.setAttribute("id","TotalChoices");
  6.         Inp.setAttribute("name","TotalChoices");
  7.         Inp.setAttribute("onchange","getAnsweresChoices(this.value,"+rowId+")");
  8.         Inp.length=5;
  9.         divEle=document.getElementById("choices_div_"+rowId);
  10.         divEle.innerHTML="<table cellspacing='0' cellpadding='0' border='0' align='center' width='600'>"+
  11.                             "<tr><td align='left' valign='middle' width='300'>Select total Answeres</td></tr>"+
  12.                             "<tr><td align='left' valign='middle' id='choicer_"+rowId+"'></td></tr>"+
  13.                             "</table>";
  14.         divChoice=document.getElementById("choicer_"+rowId);
  15.         divChoice.appendChild(Inp);
  16.         Inp.options[0].value="none";
  17.         Inp.options[1].value=2;
  18.         Inp.options[2].value=3;
  19.         Inp.options[3].value=4;
  20.         Inp.options[4].value=5;
  21.         Inp.options[0].text="Please Select Any";
  22.         Inp.options[1].text=2;
  23.         Inp.options[2].text=3;
  24.         Inp.options[3].text=4;
  25.         Inp.options[4].text=5;
  26.     }
  27.     if(choice=="TF"){
  28.  
  29.         trueFalsePopulate(rowId);
  30.     }
  31.     if(choice=="YN"){
  32.         clrAns(rowId);
  33.         YesNoPopu(rowId);
  34.     }
  35.     if(choice=="none"){
  36.         clrAns(rowId);
  37.         clrChoice(rowId);
  38.     }
  39. }
  40. function trueFalsePopulate(rowId){
  41.     xmlPopTf=GetXmlHttpObject();
  42.     if(xmlPopTf==null){
  43.         alert("Please Upgrade Your Browser");
  44.         return;
  45.     }else{
  46.         var url="ajax/populate-inputs.php";
  47.         var str_tf="r_tf="+Math.random()+"&rowId="+rowId;
  48.         xmlPopTf.onreadystatechange=$popuTrue;
  49.         xmlPopTf.open("POST",url,true);
  50.         xmlPopTf.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
  51.         xmlPopTf.send(str_tf);
  52.     }
  53. }
  54. function $popuTrue(){if(xmlPopTf.readyState==4){if(xmlPopTf.status==200){var a=xmlPopTf.responseText.split("|");clrChoice(a[1]);document.getElementById('answeres_div_'+a[1]).innerHTML=a[0];}}}
  55. function YesNoPopu(rowId){
  56.     xmlPopYn=GetXmlHttpObject();
  57.     if(xmlPopYn==null){
  58.         alert("Please Upgrade Your Browser");
  59.         return;
  60.     }else{
  61.         var url="ajax/populate-inputs.php";
  62.         var str_yn="r_yn="+Math.random()+"&rowId="+rowId;
  63.         xmlPopYn.onreadystatechange=$popuYn;
  64.         xmlPopYn.open("POST",url,true);
  65.         xmlPopYn.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
  66.         xmlPopYn.send(str_yn);
  67.     }
  68. }
  69. function $popuYn(){
  70.     if(xmlPopYn.readyState==4){
  71.         if(xmlPopYn.status==200){
  72.             var a=xmlPopYn.responseText.split("|");
  73.             clrChoice(a[1]);
  74.             document.getElementById('answeres_div_'+a[1]).innerHTML=a[0];
  75.         }
  76.     }
  77. }
  78.  
Aug 4 '09 #1

✓ answered by omerbutt

i figured it out i had the form inside the table that was the biggest mistake

1 3062
omerbutt
638 512MB
i figured it out i had the form inside the table that was the biggest mistake
Aug 4 '09 #2

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

Similar topics

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...
24
by: bedhead | last post by:
Why doesn't a SELECT element's innerHTML reflected which option was selected? Works in IE. I need this functionality so that I can retain what choices a user made in a tabbed interface. ...
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...
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: davecph | last post by:
I'm constructing a website with a layout created with div-tags. They have a fixed width, float left, and display inline. When one of the div's contain a select-element the right-most div floats down...
3
by: spoonybard | last post by:
Hi Everyone, I have an ASP.Net 2.0 C# web application that requires a user to enter in two sets of numbers. The first number is broken into 4 textboxes and the second number is broken into 2...
1
by: break9 | last post by:
I have a form that I uses javascript and <tr> tags to display or hide form fields. The problem is that Firefox won't acknowledge or pass any variables from any fields that were hidden when the page...
3
omerbutt
by: omerbutt | last post by:
sir i am making an inventory application with the help of ajax,html,dhtml,javascript php and mysql i have been working with AJAX and ASP CLASSIC ,but now i have switched to php the problem i am...
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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...

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.