Vanilla 1.1.9 is a product of Lussumo. More Information: Documentation, Community Support.
I've written an onload function that cycles through div's that have a class of sub_subslide bar. Stripped down HTML looks like this:
<form action="#" method="post"><input type="hidden" name="phpMyAdmin" value="4594f30712f4fabaff6997416810f3f2" />
<div id="submitNews">
<fieldset class="newsForm"><input type="hidden" name="phpMyAdmin" value="4594f30712f4fabaff6997416810f3f2" />
... Form Fields ...
</fieldset>
<div><div class="sub_slidebar"></div></div> <!--Wrapper to fix crap IE bug-->
</div>
</form>
Basic idea is I have a submissions page with any number of forms, that are expandable onclick. So I need a function that it flexible and doesn't need to be tied to a specific ID.
The javaScript function is this:
function slidebarPrep(){
if(!document.getElementById) return false;
var slidebar = document.getElementsByTagName("div");
for(var i = 0; i < slidebar.length; i++){
if(slidebar[i].className == "sub_slidebar"){
var parentId = slidebar[i].offsetParent.id;
var parentHeight = slidebar[i].offsetParent.clientHeight;
var subBox = document.getElementById(parentId);
subBox.style.height = "115px";
slidebar[i].setAttribute("onclick", "sub_expand(50, '"+parentId+"', '"+parentHeight+"');");
}
}
}
It works perfectly in FF but not in IE. The issue with with the setAttribute for onclick. Everything i've tried doesn't fix it. I've tried attachEvent for to see if that works for IE and it doesn't. I've also tried this:
slidebar[i].onclick = function(){
sub_expand(50, parentId, parentHeight);
}
But this generates some very strange behaviour in both FF and IE.
Does anyone have any suggestions?
slidebar[i].onclick = ...?
1 to 3 of 3