Advertisement

[x]
Attachment Details

Javascript works in IE but bot in Firefox

I have developed a calendar that is used by doctors to schedule their availability for hospital emergency room work shifts. This program generates a calendar with several shifts on each day. Each shift has a checkbox associated with it. Also on each day there is a check all checkbox that when checked will only check the checkboxes for that day.

Now this works great in IE, however in Firefox when a Check All checkbox is checked all checkboxes on the calendar are checked and not just the day the Check All checkbox is associated with.

Any help would be appreciated
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
==============================
BEGIN HEAD SECTION CODE
==============================
<script type="text/javascript">
function checkAllDay(checkbox, theCommonNodeName) {
theCommonNodeName = theCommonNodeName.toLowerCase();
var theCommonNode = checkbox.parentNode;
while(theCommonNode.nodeName.toLowerCase() != theCommonNodeName && theCommonNode != document) {
theCommonNode = theCommonNode.parentNode;
}
 
if(theCommonNode.nodeName.toLowerCase() != theCommonNodeName) {
alert("Common parent node could not be found");
return;
}
 
var inputs = theCommonNode.getElementsByTagName("input");
for(var i=0; inputs[i]; i++) {
if(inputs[i].type == "checkbox") {
inputs[i].checked = checkbox.checked;
}
}
}
</script>
==============================
END HEAD SECTION CODE
==============================
 
==============================
CODE USED IN CHECK ALL CHECK BOX
==============================
<table width=100%>
<tr><td colspan="2"><input type="checkbox" name="chkAll" onclick="checkAllDay(this, 'table');"> Check All</td></tr><tr><td align=left><input name="9069" id="1" type="checkbox" value="ok" checked></td><td align=right>09 - 18</td></tr><tr><td align=left><input name="9070" id="1" type="checkbox" value="ok" checked></td><td align=right>17 - 02</td></tr><tr><td align=left><input name="9071" id="1" type="checkbox" value="ok" checked></td><td align=right>07 - 17</td></tr><tr><td align=left><input name="9072" id="1" type="checkbox" value="ok" checked></td><td align=right>11 - 21</td></tr><tr><td align=left><input name="9073" id="1" type="checkbox" value="ok" checked></td><td align=right>17 - 02</td></tr><tr><td align=left><input name="9074" id="1" type="checkbox" value="ok" checked></td><td align=right>21 - 07</td></tr></table>
Related Solutions
Related Solutions
 
Loading Advertisement...
 
Author Comment by stanforrest:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 

Rank: Master

Expert Comment by MMDeveloper:

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
Loading Advertisement...
20080924-EE-VQP-40 / EE_QW_2_20070628