Showchild and ShowParent function, for the javascript that checks boxes of child boxes, and parent boxes, the parent function has bene disabled for netscape since netscape cant reference object correctly, and cannot distinguish difference between a string and an index location.
[tt]
function ShowChild(HID, LID, status) //HID/LID of current, and status
{
for(var j=0; j<=max; j++) //Loop through array rows
{
if ((tree[j][3] == HID) && (tree[j][4] == LID)) //if current has H/L as their parent
{
<% if instr(ucase(Request.ServerVariables("HTTP_USER_AGENT"

), "MSIE"

<> 0 then %>
if (document.all(tree[j][2]).length > 1) //if multiple with same name
{
for (i=0; i<document.all(tree[j][2]).length; i++) //go through each
document.all(tree[j][2],i).checked = status; //change each
}
else
{
document.all(tree[j][2]).checked = status; //if single change.
}
<% else %>
if (document.forms[0][tree[j][2]].length > 1) //if multiple with same name
{
for (i=0; i<document.forms[0][tree[j][2]].length; i++) //go through each
{
document.forms[0][tree[j][2]]
.checked = status; //change each
//alert("[SC]Info About Box Being Checked\n Value:" + document.forms[0][tree[j][2]].value + "\nName:" + document.forms[0][tree[j][2]].name + "\nChecked:" + document.forms[0][tree[j][2]].checked + "\ntype:" + document.forms[0][tree[j][2]].type + "\nLabel:" + document.forms[0][tree[j][2]].label + "\nNext to Be Checked:" + tree[j][0]+","+tree[j][1] + "\nCurrent Head\\Left:" + tree[j][3]+","+tree[j][4]+ "\nName Looked For:" + tree[j][2]);
}
}
else
{
document.forms[0][tree[j][2]].checked = status; //if single change.
//alert("[SC]Info About Box Being Checked\nValue:" + document.forms[0][tree[j][2]].value + "\nName:" + document.forms[0][tree[j][2]].name + "\nChecked:" + document.forms[0][tree[j][2]].checked + "\ntype:" + document.forms[0][tree[j][2]].type + "\nLabel:" + document.forms[0][tree[j][2]].label + "\nNext to Be Checked:" + tree[j][0]+","+tree[j][1] + "\nCurrent Head\\Left:" + tree[j][3]+","+tree[j][4]+ "\nName Looked For:" + tree[j][2]);
}
<% end if %>
Cstacklev += 1;
ShowChild(tree[j][0],tree[j][1], status); //resubmit's its own for it's children
Cstacklev -= 1;
}
}
//alert("[SC]Finished Stack Level : " + Cstacklev);
}
function ShowParent(HP, LP) //HP/LP IDs being looked for as current then it's parent is submited
{
for(var j=0; j<=max; j++) //from 0 index to max recorded rows
{
if ((tree[j][0] == HP) && (tree[j][1] == LP)) // if ID matches HP/LP
{
<% if instr(ucase(Request.ServerVariables("HTTP_USER_AGENT"
), "MSIE"
<> 0 then %>
if (document.all(tree[j][2]).length > 1) // if multiple control w/ same name
{
for (i=0; i<document.all(tree[j][2]).length; i++) //loop through each
{
var str1 = document.all(tree[j][2],i).label;
var str2 = tree[j][5];
if (str1.toLowerCase() == str2.toLowerCase())
{ //if current control matches the label for the "True" parent
document.all(tree[j][2],i).checked = true;
}
}
}
else //if there is only one control with that name
{
document.all(tree[j][2],0).checked = true;
}
<% else %>
/*
if (document.forms[0][tree[j][2]].length > 1) // if multiple control w/ same name
{
for (i=0; i<document.forms[0][tree[j][2]].length; i++) //loop through each
{
var str1 = document.forms[0][tree[j][2]].label;
var str2 = tree[j][5];
if (str1.toLowerCase() == str2.toLowerCase())
{ //if current control matches the label for the "True" parent
document.forms[0][tree[j][2]].checked = true;
alert("[SP]Info About Box Being Checked\nValue:" + document.forms[0][tree[j][2]].value + "\nName:" + document.forms[0][tree[j][2]].name + "\nChecked:" + document.forms[0][tree[j][2]].checked + "\ntype:" + document.forms[0][tree[j][2]].type + "\nLabel:" + document.forms[0][tree[j][2]].label+ "\nNext to Be Checked:" + tree[j][3]+","+tree[j][4] + "\nCurrent Head\\Left:" + tree[j][0]+","+tree[j][1]+ "\nName Looked For:" + tree[j][2]);
}
}
}
else //if there is only one control with that name
{
document.forms[0][tree[j][2]].checked = true;
alert("[SP]Info About Box Being Checked\n Value:" + document.forms[0][tree[j][2]].value + "\nName:" + document.forms[0][tree[j][2]].name + "\nChecked:" + document.forms[0][tree[j][2]].checked + "\ntype:" + document.forms[0][tree[j][2]].type + "\nLabel:" + document.forms[0][tree[j][2]].label + "\nNext to Be Checked:" + tree[j][3]+","+tree[j][4]+ "\nCurrent Head\\Left:" + tree[j][0]+","+tree[j][1] + "\nName Looked For:" + tree[j][2]);
}*/
<% end if %>
Pstacklev += 1;
ShowParent(tree[j][3],tree[j][4]); //continue to search by submiting parent of current
Pstacklev -= 1;
}
}
//alert("[SP]Finished Stack Level : " + Pstacklev);
}
[/tt]
and here is the lines that create the names, and "Label" so to speak.
[tt]
if Pname = "" then 'will be modified when we need to find parents of children
HTMLStr = HTMLStr & writetabs(Spaces) & vbcrlf & "<input onclick=""javascript:ShowChild(" & TheObj(HID,j) & "," & TheObj(LID,j) & ",this.checked)"" type=""" & TheObj(RType, j) & """ name=""" & TheObj(Name, j) & """ value=""" & TheObj(Value,j) & """ label=""" & TheObj(Label, j)& """>"
else
HTMLStr = HTMLStr & writetabs(Spaces) & vbcrlf & "<input onclick=""javascript:ShowParent(" & TheObj(HP,j) & "," & TheObj(LP,j) & "
; ShowChild(" & TheObj(HID,j) & "," & TheObj(LID,j) & ",this.checked);"" type=""" & TheObj(RType, j) & """ name=""" & TheObj(Name, j) & """ value=""" & TheObj(Value,j) & """ label=""" & TheObj(Label, j)& """>"
end if
[/tt]
ok now that you've seen functions, now what, and yes they both should behave pretty much the same, If i say I want checkbox "5" to be checked, both IE and NS should do this "simple" task. I am not talking about anything on complex level, as you can see from both ShowChild and ShowParent, the IE and NS are the same, other than the way they reach the checkboxes (IE = document.all , NS = document.forms)
to put it frankly I hate NS, most of my projects are extended by hours just to make then NS friendly especially with the damn limitations that netscape has ont he client side. [sig]<p>Karl<br><a href=mailto:kb244@kb244.com>kb244@kb244.com</a><br><a href= </a><br>Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)<br>
[/sig]