Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    IE function problem

    Hey,

    I am having some problems getting a function to work in IE, when it works in other browsers.

    Code:
    function toggleC (obj)
    {
    	var cats = obj.parentNode.getElementsByClassName('category');
    	var effects = [];
    	for (var i = 0; i < cats.length; i++) 
    	{
    		if (cats[i].tagName == "DIV" && cats[i].parentNode.id == obj.parentNode.id)
    		{
    			if (cats[i].id != obj.id)
    			{
    				
    				if (Element.visible(cats[i])) {
    					effects.push( new Effect.SlideUp(cats[i],{sync: true, duration: 0.5 }) );
    				}
    			} else
    			{
    				if (!Element.visible(cats[i])) {
    					effects.push( new Effect.SlideDown(cats[i],{sync: true, duration: 0.4}) );
    				} else effects.push( new Effect.SlideUp(cats[i],{sync: true, duration: 0.4}) );
    			}			
    				
    		}			
    	}
    	new Effect.Parallel(effects, {duration: 0.4});
    	
    }
    For some reason, the first line of the function is firing a error.
    IE is saying that the object that I'm searching for doesn't support the method. Basically the function is called from a icon inside the div ( toggleC(this); ).

    Any help is hugely appreciated !

  • #2
    Regular Coder PremiumBlend's Avatar
    Join Date
    Apr 2006
    Location
    Marion, Iowa
    Posts
    201
    Thanks
    0
    Thanked 13 Times in 13 Posts
    I did a simple test in IE and got it to error when the function definition looked like this:

    Code:
    function toggleC (obj)
    but was fine when it looked like this:


    Code:
    function toggleC(obj)
    The only difference is that space between the toggleC and the first "(".
    My Website: DumpsterDoggy

  • #3
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the reply, but still getting the same error.
    By the first line, I meant "var cats = obj.parentNode.getElementsByClassName('category');" (ignore the function name etc. )

    I went as far as to remove everything except these lines,
    Code:
    function toggleC(obj)
    {
    		var cats = obj.parentNode.getElementsByClassName('category');
    }
    and the same error is still coming up : "Object doesn't support this property or method"

  • #4
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I decided to give up on the getElementsByClassName function, and go with something like this :

    Code:
    	var cats = obj.parentNode.childNodes;
    	for (var i = 0; i < cats.length; i++) 
    	{
    		if (cats[i].className == "category")
    		{

  • #5
    Regular Coder PremiumBlend's Avatar
    Join Date
    Apr 2006
    Location
    Marion, Iowa
    Posts
    201
    Thanks
    0
    Thanked 13 Times in 13 Posts
    Are you still getting errors or did your changes fix it?
    My Website: DumpsterDoggy

  • #6
    New to the CF scene
    Join Date
    Aug 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The change fixed it, must have been a problem with getElementsByClassName.
    Thanks for the input though.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •