Trickist,
Main problem is in the exit conditions of the for statements, eg.:
for(i=0; i<=dr.length; i++) {...}
//should read
for(i=0; i<dr.length; i++) {...}
The code can be simplified elsewhere, chiefly to work with elements rather than their ids.
var j = ø(a[i].parentNode.id).parentNode.id;
//will simplify to
var j = a[i].parentNode.parentNode.id;
//and
var j = a[i].parentNode.parentNode;
//will allow you to pass the element rather than its id to setwid(), which is more useful.
conwidth() would be improved by looping through the container (.parentNode.parentNode) elements. Looping through the dropdowns causes each container to be addressed several times over, with the nett effect that the last dropdown in each container determines its width.
You probably want the longest dropdown to determine the width of its container, requiring that (for each container) a running maximum is maintained, which feeds the statement container.style.width = maximum + "px"; (or similar).
Airshow
Airshow
WiFi Lounge Lizard
2,782 posts since Apr 2009
Reputation Points: 370
Solved Threads: 389
Skill Endorsements: 10
maximum would be a variable containing the running maximum calculated in the loop. Then the statement container.style.width = maximum + "px"; would be executed below the loop.
I can't rewrite conwidth() in full without knowledge of the HTML.
Airshow
Airshow
WiFi Lounge Lizard
2,782 posts since Apr 2009
Reputation Points: 370
Solved Threads: 389
Skill Endorsements: 10
That's invalid HTML. You can't have a DIV inside a UL like that.
Airshow
Airshow
WiFi Lounge Lizard
2,782 posts since Apr 2009
Reputation Points: 370
Solved Threads: 389
Skill Endorsements: 10