unable to laod particular division when window is loading.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kailashchandra
    New Member
    • Sep 2008
    • 5

    unable to laod particular division when window is loading.

    Below is my code.i want the first division should be load when window is loading.

    Code:
    <HTML>
    <HEAD>
    <script>
    function tabFunc(getthis)
    {
    	var getIn=getthis.innerHTML;
    	var getId=getIn+'_content';
    	var divId=document.getElementById('content');
    	var divlen=divId.getElementsByTagName('div');
    
    	for (var i=0;i<divlen.length;i++ )
    	{
    		if(divlen[i].id != getId)
    		{
    			divlen[i].style.display='none';
    		}
    		else
    		{
    			divlen[i].style.display='block';
    		}
    	}
    
    	var par=getthis.parentNode;
    	var mm=par.getElementsByTagName('td');
    	for(var i=0;i<mm.length-1;i++)
    	{
    		if(mm[i]==getthis)
    		{
    			mm[i].className='click';
    
    		}
    		else
    		{
    			
    			mm[i].className='Normal';
    		}
    	}
    }
    </script>
    <style>
    .Normal {background-color:#FF0000;cursor:pointer;}
    .click {background-color:#FFFFFF;cursor:pointer;}
    td{
    	border:none;
    	font-family:verdana,arial;
    	font-size:12px;
    	}
    table{
    	border:none;
    	}
    </style>
     </HEAD>
    
     <BODY>
      <table border="0" background="back.gif" height="100%" width="100%">
    	<tr>
    		<td>
    			<table cellspacing="0" cellpadding="0" width="100%" border="2" height="100%">
    				<tr height="23px">
    					<td class="Normal" onclick="tabFunc(this);" style="width:50px; background-position:right; padding-left:20px;padding-right:20px;border-left:1px solid #000000;">Home</td>
    					<td class="Normal" onclick="tabFunc(this);" style="width:50px;background-position:right; padding-left:20px;padding-right:20px;border-left:1px solid #000000;" >Operation</td>
    					<td class="Normal" onclick="tabFunc(this);" style="width:50px;background-position:right; padding-left:20px;padding-right:20px;border-left:1px solid #000000;" >Administration</td>
    					<td width="100%" style="border-bottom:1px solid #000000;">&nbsp;</td>
    				</tr>
    				<tr>
    					<td colspan="4" id="content" style="height:100%;width:100%;border-top:0px;border-left:1px solid #000000;border-bottom:1px solid #000000;border-right:1px solid #000000;">
    						<div id="Home_content" style="display:none;height:100%;width:100%;border:0px solid #000000;">Home_contentet</div>
    						<div id="Operation_content" style="display:none;height:100%;width:100%;border:0px solid #000000;">Operation_contentet</div>
    						<div id="Administration_content" style="display:none;height:100%;width:100%;border:0px solid #000000;">Administration_content</div>
    					</td>
    				</tr>
    			</table>
    		</td>
    	</tr>
      </table>
     </BODY>
    </HTML>
    in the above code i want the Home_Content should be default loaded when i running the script.please help me.
    Last edited by acoder; Nov 5 '08, 09:34 AM. Reason: fixed code tags
  • risk32
    New Member
    • Mar 2008
    • 98

    #2
    Try giving your Home DIV an id, then use your tab function to call the id instead of (this). It might work, it might not. Just giving an idea that sounds right.

    Comment

    Working...