Help please!

Discussion in 'JavaScript' started by stompergames, Nov 19, 2008.

  1. #1
    Javascript:
    
    function expand(div)
    {
    	var expand=document.getElementById(div).style;
    
    	if (expand.display=="none")
    	{expand.display="block";}
    	else
    	{expand.display="none";}
    }
    
    Code (markup):
    HTML
    
    <ul>
    			<li><a href="javascript:expand('seasonal')">Holiday Updates</a></li>
        			<li id="seasonal">
    				<ul>
              			        <li><a href="#">1</a></li>
             				<li><a href="#">2</a></li>
          				</ul>
        			</li>
    			<li><a href="javascript:expand('volunteer')">Volunteer</a></li>
    			<li id="volunteer">
    				<ul>
              				<li><a href="#">1</a></li>
              				<li><a href="#">2</a></li>
                      		</ul>
          			</li>
        			</ul>
    
    Code (markup):
    Its not expanding it or doing anything, I am getting an "object expected" error.

    Please help, it is greatly appreciated. Rep for sure
     
    stompergames, Nov 19, 2008 IP
  2. lp1051

    lp1051 Well-Known Member

    Messages:
    163
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    108
    #2
    Hi, I tried your code and it works fine on IE, FF. Clean your cache, or the error is some other code on the page
     
    lp1051, Nov 19, 2008 IP