Connecting Tech Pros Worldwide Help | Site Map

unable to laod particular division when window is loading.

Newbie
 
Join Date: Sep 2008
Posts: 5
#1: Sep 20 '08
Below is my code.i want the first division should be load when window is loading.

Expand|Select|Wrap|Line Numbers
  1. <HTML>
  2. <HEAD>
  3. <script>
  4. function tabFunc(getthis)
  5. {
  6.     var getIn=getthis.innerHTML;
  7.     var getId=getIn+'_content';
  8.     var divId=document.getElementById('content');
  9.     var divlen=divId.getElementsByTagName('div');
  10.  
  11.     for (var i=0;i<divlen.length;i++ )
  12.     {
  13.         if(divlen[i].id != getId)
  14.         {
  15.             divlen[i].style.display='none';
  16.         }
  17.         else
  18.         {
  19.             divlen[i].style.display='block';
  20.         }
  21.     }
  22.  
  23.     var par=getthis.parentNode;
  24.     var mm=par.getElementsByTagName('td');
  25.     for(var i=0;i<mm.length-1;i++)
  26.     {
  27.         if(mm[i]==getthis)
  28.         {
  29.             mm[i].className='click';
  30.  
  31.         }
  32.         else
  33.         {
  34.  
  35.             mm[i].className='Normal';
  36.         }
  37.     }
  38. }
  39. </script>
  40. <style>
  41. .Normal {background-color:#FF0000;cursor:pointer;}
  42. .click {background-color:#FFFFFF;cursor:pointer;}
  43. td{
  44.     border:none;
  45.     font-family:verdana,arial;
  46.     font-size:12px;
  47.     }
  48. table{
  49.     border:none;
  50.     }
  51. </style>
  52.  </HEAD>
  53.  
  54.  <BODY>
  55.   <table border="0" background="back.gif" height="100%" width="100%">
  56.     <tr>
  57.         <td>
  58.             <table cellspacing="0" cellpadding="0" width="100%" border="2" height="100%">
  59.                 <tr height="23px">
  60.                     <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>
  61.                     <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>
  62.                     <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>
  63.                     <td width="100%" style="border-bottom:1px solid #000000;">&nbsp;</td>
  64.                 </tr>
  65.                 <tr>
  66.                     <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;">
  67.                         <div id="Home_content" style="display:none;height:100%;width:100%;border:0px solid #000000;">Home_contentet</div>
  68.                         <div id="Operation_content" style="display:none;height:100%;width:100%;border:0px solid #000000;">Operation_contentet</div>
  69.                         <div id="Administration_content" style="display:none;height:100%;width:100%;border:0px solid #000000;">Administration_content</div>
  70.                     </td>
  71.                 </tr>
  72.             </table>
  73.         </td>
  74.     </tr>
  75.   </table>
  76.  </BODY>
  77. </HTML>
  78.  
in the above code i want the Home_Content should be default loaded when i running the script.please help me.
risk32's Avatar
Member
 
Join Date: Mar 2008
Location: Evansville, IN / Hurlburt Field, FL
Posts: 88
#2: Nov 5 '08

re: unable to laod particular division when window is loading.


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.
Reply