Forum Discussion
As an FYI, we got this working (Lithium Supoort was kind enough to find the error) - although not the most elegant solution. We found that the javascript was attempting to modify the incorrect style sheet.
var rule = document.styleSheets[0].rules ? document.styleSheets[0].rules : document.styleSheets[0].cssRules;
Since the style sheet was not the first one loaded, this obviously wasn't working. We've since ran a debug and watched the load to find which number sheet it was to make this work. Unfortunately any changes to the platform could break it at any time. We'd like to update the code to cycle through all of the sheets to find the appropriate one but have not found the correct code to do so. Currently we're attempting to use/modify:
function showHide(cls, show) { for (var i=0; i<document.styleSheets.length; i++) { // browser-compatibility var rule = document.styleSheets[i].rules ? document.styleSheets[i].rules : document.styleSheets[i].cssRules; for (var j = 0; j < rule.length; j++) { if (rule[j].selectorText == "." + cls) { //find css selector rule[j].style.display = (show) ? 'block' : 'none'; } } } }
This isn't working either though. Anyone out there good with javascript to help us find what is incorrect with this one?
Related Content
- 14 years ago