SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: onLoad command

  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2004
    Location
    Brazil
    Posts
    91
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onLoad command

    Hi all,

    I made a page with several tables showing birthday date and name on it, each month has it own link and when you click on the same, it displays only the tables within the referent month. Well after all it works fine, but the Javascript, before get all things to work, he loads all the tables in the screen, showing all of them at once.

    Well thatīs the onLoad function, but I was wondering if thereīs some other command so the page doesnīt load it all first, in fact, I want it to load only the tables for the link you click, and not it to load it all before you start exploring the months. Hope I could explain it, if not, please ask me for the code.

  2. #2
    SitePoint Wizard
    Join Date
    Nov 2004
    Location
    Portsmouth UK
    Posts
    1,498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    no easy to understand you requirement but

    PHP Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd"
    >

    <
    html>

    <
    head>
      <
    title></title>
    <
    script language="JavaScript" type="text/javascript">
    <!--

    function 
    Toggle(tr){
     if (
    document.getElementById(tr).style.display=='none'){
      
    document.getElementById(tr).style.display='block';
     }
     else {
       
    document.getElementById(tr).style.display='none';
     }
    }

    //-->
    </script></head>

    <body>

    </body>
    <table width=200 cellpadding="0" cellspacing="0" border="1"  bgcolor=#FFFF99 >
      <tr>
        <td  bgcolor=#FFFFCC onclick="javascript:Toggle('W1');" >Show/Hide 1</td>
      </tr>
      <tr id=W1 style="position:relative;display:none;" >
        <td>whatever 1</td>
      </tr>
      <tr>
        <td  bgcolor=#FFFFCC onclick="javascript:Toggle('W2');" >Show/Hide 2</td>
      </tr>
      <tr id=W2 style="position:relative;display:none;" >
        <td>whatever 2</td>
      </tr>
      <tr>
        <td bgcolor=#FFFFCC onclick="javascript:Toggle('W3');" >Show/Hide 3</td>
      </tr>
      <tr id=W3 style="position:relative;display:none;" >
        <td>whatever 3</td>
      </tr>
    </table>

    </html> 


Bookmarks

Posting Permissions

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