1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

JavaScript help

Discussion in 'JavaScript' started by red_fiesta, Dec 14, 2006.

  1. #1
    what is wrong with this code?

    
    function display_select2(id)
    {
    	var objects2 = new Array('1a', '2a', '3a', '4a', '5a', '6a');
    
    	
    	for (var i in objects2)
    	{
    	var element2 = document.getElementById(objects2[i]);
    	
    	element2.style.display = "inline";
    	element2.style.visibility = "visible";
    		}
    	
    return false;
    }
    
    
    Code (markup):
     
    red_fiesta, Dec 14, 2006 IP
  2. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #2
    What is the error?
     
    mad4, Dec 14, 2006 IP
  3. red_fiesta

    red_fiesta Peon

    Messages:
    125
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    What is happening is when a name is clicked that opens a div which shows a select box and a go button that works fine.

    then what is supposed to happpen is when one chooses the last option in the select box a text box is shown. at the moment when someone clicks the last option it just hides both spans i am trying to show the one with the select box and the one with the text box.


    here is a bigger section of the code


    <% 
    bigCounter=1
    
      sub ListFolderContents(path)
    
         dim fs, fo , File, items, url
    
         set fs = CreateObject("Scripting.FileSystemObject")
         set fo = fs.GetFolder(path)
    	
    %>
    
    			<li ><%=fo.Name%>
    				<ul>
    
    <%
    
         'Display a list of files.
         for each items in fo.Files
    		url = MapURL(items.path)
    
    		if counter = 1 then 
    			  arraySection = "'" & bigCounter& "'" 
    			  arraySection2 = "'" & bigCounter & "a'"  
    			  else
    			  arraySection = arraySection & ", '" &  bigCounter & "'"
    			  arraySection2 = arraySection2 & ", '" &  bigCounter & "a'"
       	   end if 
    %> 
    <form action="activeCodeStep2.asp" method="post">
    <li style="padding-top:3px; padding-bottom:3px;"><a href="#" onclick="return display_select('<%=bigCounter %>');"><%=items.Name %></a>
    	<span id="<%=bigCounter%>" style="display: none;">
    						
    						<select name="pageOption" style="margin-top:0px; padding:0px;">
    						<option value="add">Add Page Below</option>
    						<option value="addfolder" onclick="return display_select('<%=bigCounter & "a"  %>');">Create New Folder at this level</option>
    						</select>
    						
    					
    
    						  <span id="<%=bigCounter & "a" %>" style="display:none; padding:0px; margin:0px;">
    						 	<input type="text" name="newFolder" style="width:100px;" />
    						   </span>
    						<input type="submit" value="GO!" />
    	</span>
    	
    </li>
     </form>
    <%	   
    		counter = counter+1
    		bigCounter = bigCounter + 1
    		
    		
    	 next
    
    	  
    	 
     mainCounter = mainCounter +1
      end sub
    
    
    %>
    <script type="text/javascript">
    <!--
    function display_select(id)
    {
    	var objects = new Array(<%=arraySection%>);
    
    	
    	for (var i in objects)
    	{
    	var element = document.getElementById(objects[i]);
    	
    	element.style.display = element.id == id ? 'inline' : 'none';
    	}
    	
    return false;
    }
    
    function display_select2(id)
    {
    	var objects2 = new Array(<%=arraySection2 %>);
    
    	
    	for (var i in objects2)
    	{
    	var element2 = document.getElementById(objects2[i]);
    	
    	element2.style.display = "inline";
    	element2.style.visibility = "visible";
    		}
    	
    return false;
    }
    //-->
    </script>
    Code (markup):
     
    red_fiesta, Dec 14, 2006 IP
  4. weknowtheworld

    weknowtheworld Guest

    Messages:
    306
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    please make me understand that wht's going here?
     
    weknowtheworld, Dec 18, 2006 IP