Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Netscape and Selection of object kind of a brain teaser for me

Status
Not open for further replies.

Karl Blessing

Programmer
Feb 25, 2000
2,936
US
this is an old, but revisited problem, currently the the IE version works just fine when selecting, but not the netscape.

(I use ASP, which returns different javascript routines for IE and NS, so that the Document Object Model isnt messed up)

this is the javascript sniplet for netscape
(currently commented out as it does not work)
Code:
/*
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 &quot;True&quot; parent
			document.forms[0][tree[j][2]][i].checked = true;
		}
	}
}
else //if there is only one control with that name
{
	document.forms[0][tree[j][2]].checked = true;
}
*/

What I have is a simulated tree of checkboxes and radios, that form a hiarchy, in a javascript array (created from a server-side vb array) which keeps track of the Parent child relationships.

As far as I can tell that part of it works fine in both NS and IE as, the tree is formed and so forth, the problem lies in the referencing of the object

The Root parents have Numbers as names

1,2,3,4,5 so forth, main parents are numeric, as their children start with those main numbers, but have characters in them, such as 5_1 or 5-6.

In IE, referencing to the &quot;5&quot; works fine, but in NS , it thinks I want to reference the 5th object on the page (which is much further away than &quot;5&quot;) so the parent validation never works in NS.

Does anyone know of a way where I can force NS to use &quot;5&quot; as a name, and not as an ordinal to it's numeric sequence.

Or better yet, how can I figure out which # that particular parent is, so if I detect netscape , I Could create an array to find the index for a name (might be more work, but if it'll work, then I'd want to do it)

Thanks in Advance
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
Quick solution:

Don't use numbers as names. I've had this problem before when printing elements from ASP and trying to reference them. I ended up changing to checkbox_1, instead of just 1.

Better solution:

Probably gonna take some time, so I'll get back to you. :) jared@aauser.com
 
well your quick solution, takes a long time for me to change the namming convention.

the better solution, might be a quick solution for me.
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
can you give me a link to the full (client-side) source and maybe email me the server-side portions? jared@aauser.com
 
I emailed you both the URL instructions (how to get there) and the source for just the multitree.asp

the source is pretty heavily commented, so I dont think you'll be too badly confused until you hit some of the VBscript and Javascript rescursive routines.
Karl
kb244@kb244.com
Experienced in : C++(both VC++ and Borland),VB1(dos) thru VB6, Delphi 3 pro, HTML, Visual InterDev 6(ASP(WebProgramming/Vbscript)

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top