473,503 Members | 1,715 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript & Browser compatiblity?

1 New Member
I'm builiding an online insurance application, where people input thier data, and it gives them rates, then lets them apply. I was wondering if someone could take a look and maybe tell me what the issue is?

Here is the url: http://67.62.217.33/test5

You will need to supply a valid zip, as it does a check for areas the insurance is available. You can use 23834

The issue I'm having is on the the next page there, intro-page2.asp, if you fill in your information or select add a child and then submit that, it takes you to the page with your quotes. No problem there. The problem is that if you use either the back button I have on the page or the browsers in IE, nothing is retained and the dropdowns disappear. But in FF, everything is fine.

Here is the JS I'm using to create the dropdowns:
Expand|Select|Wrap|Line Numbers
  1. function addEvent()
  2. {
  3. var ni = document.getElementById('myDiv');
  4. var numi = document.getElementById('theValue');
  5. //var num = (document.getElementById("theValue").value - 1)+ 2;
  6. var num = (document.getElementById("theValue").value -1)+ 2;
  7. numi.value = num;
  8. var divIdName = "my"+num+"Div";
  9. var newdiv = document.createElement('div');
  10. newdiv.setAttribute("id",divIdName);
  11. newdiv.innerHTML = 
  12. "<tr align=\"right\">"+
  13. "<td width=\"66\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Child&nbsp;&nbsp;&nbsp;</td>"+
  14. "<td width=\"78\">"+
  15. "<select name=\"child"+num+"_gender\" id=\"child"+num+"_gender\">"+
  16. "<option value=\"\" selected>- -<\/option>"+
  17. "<option value=\"Male\">Male<\/option>"+
  18. "<option value=\"Female\">Female<\/option>"+
  19. "<\/select>"+
  20. "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<\/td>"+
  21. "<td width=\"169\">"+
  22. "<input name=\"child"+num+"_dob_mm\" type=\"text\" id=\"child"+num+"_dob_mm\" style=\"width: 30px;\" />"+
  23. "&nbsp;/ <input name=\"child"+num+"_dob_dd\" type=\"text\" id=\"child"+num+"_dob_dd\" style=\"width: 30px;\" />"+
  24. "&nbsp;/ <input name=\"child"+num+"_dob_yyyy\" type=\"text\" id=\"child"+num+"_dob_yyyy\" style=\"width: 40px;\" />"+
  25. "<\/td>"+
  26. "<td width=\"59\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"child"+num+"_tobacco\" type=\"checkbox\" id=\"child"+num+"_tobacco\" /></td>"+
  27. "<td width=\"74\">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"child"+num+"_college\" type=\"checkbox\" id=\"child"+num+"_college\" /></td>"+
  28. "<td width=\"69\" >&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input name=\"child"+num+"_hippa\" type=\"checkbox\" id=\"child"+num+"_hippa\" /></td>"+
  29. "<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"javascript:;\" onclick=\"removeEvent(\'"+divIdName+"\')\">Remove<\/a></td>"+
  30. "<\/tr>";
  31. ni.appendChild(newdiv);
  32.  
  33. }
  34.  
  35.  
  36. function removeEvent(divNum)
  37. {
  38. var d = document.getElementById('myDiv');
  39. var olddiv = document.getElementById(divNum);
  40. d.removeChild(olddiv);
  41. }
  42.  
I also included the following snippet of ASP code to the top of my page:
Expand|Select|Wrap|Line Numbers
  1. <% Response.CacheControl = "no-cache" %>
  2. <% Response.AddHeader "Pragma", "no-cache" %>
  3. <% Response.Expires = -1 %>
  4.  
The reason I added this was becasue in IE, when you page back the dropdowns disappear and if you try to re-add them and re-post the page, the values corresponding to the "Add Child" dropdown don't post. However in FF, everything works fine. So that little bit of ASP was the only way I could get the values to refresh & work.

I'm in desperate need of help to figure out the problem here, cause I've tried everything I can think of and I can't get it to work properly in IE.

Thanks in advance.
Oct 3 '06 #1
1 1263
acoder
16,027 Recognized Expert Moderator MVP
Elements added dynamically won't remain once you leave the page, so you need to add them again onload.
May 20 '08 #2

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

Similar topics

14
2798
by: John Bentley | last post by:
Note this is crossposted to comp.lang.javacript and microsoft.public.dotnet.scripting. After some Googling and FAQing my understanding of these terms is, crudely: Javascript (3 different...
14
5423
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net...
8
2781
by: Nathan Sokalski | last post by:
I add a JavaScript event handler to some of my Webcontrols using the Attributes.Add() method as follows: Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"...
3
1398
by: Ivan P | last post by:
Hello! I have a index.php that on one click calls via AJAX a file.php. index.php looks like this: <html > <head> <script language="javascript" type="text/javascript" >
11
2758
by: Nathan Sokalski | last post by:
I add several JavaScript events (onchange, onkeypress, etc.) to Controls using the Add method of the Attributes collection. However, if the JavaScript code contains certain characters, such as & or...
26
1680
by: Laurent Bugnion [MVP] | last post by:
Hi group, In agreement with the head of our R&D department, I published my firm's JavaScript Coding Guidelines. I work for Siemens Building Technologies. We developed these guidelines for a web...
3
1646
by: DVir | last post by:
I am having problem with IE. This is the code that I am using, and it works good in every browser except in IE. If somebody can help PLEASE: <script language="Javascript" type="text/javascript">...
4
1429
by: pmactdot | last post by:
Hi, I'm looking for some assistance on a case study...I have two arrays <head>: one for daily special dish name, second for the daily dish description, then I have two document.write: a daily...
5
2922
by: Nike1984 | last post by:
I'm fairly new to Javascript and it's more of a guessing game for me... I'm trying to build an app for Google Maps and just had some issues recently. First off I just wanted to say that everything...
0
7203
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7087
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.