Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 5 of 5
  1. #1
    Junior Member
    Join Date
    Feb 2004
    Posts
    2
    Member #
    4849
    Hi,
    I'm currently designing my 1st big website as a college project. I have chosen to try & design as much of the site as possible using tables, however I have a quick question which somebody might b able to help me with. Is it possible to give a table cell a name suck as "Main Display" & then use the target attribute to get links to open up within that cell, as is the case if using frames? If this is not possible, can a frameset be nested within the <td> or does the complete index.htm page have to be reloaded (with the necessary changes) each time a link is clicked so as to keep the general design of the site constant?

    I've tried to be as clear as possible as to what I'm need to achieve but if no one understands what I'm talking about please ask me to explain it better as I desperately in need of some expert help.

    Thanks.

  2.  

  3. #2
    Senior Member justlivyalife's Avatar
    Join Date
    Jul 2003
    Location
    Birmingham, UK
    Posts
    2,871
    Member #
    2374
    I understand what you mean, I think. Don't trust me on this, but what I think you can do is make use of I-frames in your page. IE, in a home page, you would have a content I-frame below your navigation bar, and you would use the following code to implement the iframe:
    Code:
    <iframe src="iframe.html" width="760px" height="100px" name="iframe">
    Then, to load a page in the frame, you would use the [minicode]target="iframe"[/minicode] attribute in the <a href> tag for your link.

    The above code is not tried or tested, I just wrote it but I think it does what you are talking about.

    As far as I know, I don't think you can apply a name to a cell <td>... Though I mnay be wrong.
    justlivyalife - The future depends on what we do in the present. (Mahatma Gandhi)
    WDF Resources: WDF Rules
    Non-WDF: JavascriptSource | Dynamic Drive | phpBB | HTML-Kit | Winamp | Download Firefox | Morguefile

  4. #3
    Senior Member james's Avatar
    Join Date
    May 2003
    Location
    Melbourne, AUSTRALIA
    Posts
    364
    Member #
    1352
    IMHO the IFRAME solution is worse than frames!

    If you want links to open up content in table cells or divs, you can do it, but neither have a src attribute. It would be nice if they did, but you have to do it with DHTML, ie, Javascript.

    What you do is give your cell (or div) an id, then change its contents using [minicode]document.getElementById('cell_id').innerHTML = 'New content';[/minicode].

    Example 1:
    Code:
    <a href="javascript:document.getElementById('div_id').innerHTML='You clicked 1'); return false;">Link 1</a><br />
    <a href="javascript:document.getElementById('div_id').innerHTML='You clicked 2'); return false;">Link 2</a>
    <div id="div_id"></div>
    (untested).

    If you're going to do a whole menu system, you'd be best off putting all the document.getElementById stuff inside a function called MenuClick() (for example), like this...

    Example 2:
    Code:
    <script language="JavaScript">
      function MenuClick(selected) {
        var OutputID = 'div_id';
        switch (selected) {
          1: document.getElementById(OutputID).innerHTML = 'You clicked 1'; break;
          2: document.getElementById(OutputID).innerHTML = 'You clicked 2'; break;
        }
      }
    </script>
    
    <a href="javascript:MenuClick(1); return false;">Link 1</a><br />
    <a href="javascript:MenuClick(1); return false;">Link 1</a><div id="div_id"></div>
    (untested).

    By doing it like that, you can store all the content in the function MenuClick(), so you can write a lot more.
    James H
    Home Page · Mars Page · www.fihsf1.net (formerly www·fihs·net)

  5. #4
    Senior Member james's Avatar
    Join Date
    May 2003
    Location
    Melbourne, AUSTRALIA
    Posts
    364
    Member #
    1352
    Or then again, just use IFRAMES ;-)
    James H
    Home Page · Mars Page · www.fihsf1.net (formerly www·fihs·net)

  6. #5
    Junior Member
    Join Date
    Feb 2004
    Posts
    2
    Member #
    4849
    Thanks for your input all the same justlivyalife but the solution offered by James is exactly what I'm looking for.

    Only problem is I don't think I'm implementing it correctly, I keep getting a Page Cannot Be Displayed error & I know for a fact the page I want is in the dir I pointed it to! Here is where I implemented the suggested code by James

    /* Here is the actually Javascript I'm using at the top of the page */

    <script language="JavaScript">
    function MenuClick(selected) {
    var OutputID = 'Display';
    switch (selected) {
    1: document.getElementById(OutputID).innerHTML = 'Pages/Homepage/Main.htm'; break;
    2: document.getElementById(OutputID).innerHTML = 'Pages/Homepage/Test2.htm'; break;

    }
    }
    </script>

    /* Here is where I'm calling the script from */

    <td align="center" bgcolor="#B098EC">
    <font color="#FFFFFF" face="Tahoma" size="3">
    <p>
    <a href="java script:MenuClick(1); return false;">Link 1</a>
    </p>
    </font>
    </td>

    /* Here is the cell I want the link page to open in */

    <td align="center" rowspan="2" style="background: #FFFFFF" id="Display">
    <font color="#000000" face="Tahoma" size="+2">
    p>Main Display</p>
    <p align="center">
    </p>
    </font>
    </td>

    Obviously I haven't quiet caught the idea behind James' explaination, any pointers gratefully received.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 10:49 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com