1. This website uses cookies. By continuing to use this website you are giving consent to cookies being used.
    For information on cookies and how you can disable them visit our Cookie Usage page.
    Dismiss Notice

JavaScript Question on targeting table cells

Discussion in 'Web Development' started by johnnyoak, Mar 29, 2007.

  1. johnnyoak

    johnnyoak New Member

    Hey everyone....
    I'm currently designing a site using the fire rescue layout and was wondering how I could target the table cell that says "recent news" as if it were a frame....basically I want to have all of the links at the top open in that cell instead of reloading to a whole new page....I have found some info on using the iframe code?....but it seems to not work with how the page is coded (or i am doing something majorly wrong haha)....Anyway, if anyone could point me in the right direction on this, it would be MUCH appreciated. Thanks for your help and the great templates! : )

    Johnny
    www.johnnyoak.com
    www.myspace.com/johnnyoakmusic
     
  2. TheJester

    TheJester New Member

    Search For Javascript Tabs...

    Johnny,
    What you are trying to accomplish is something very similar to using tabs with Javascript. There are TONS of tutorials out on the net for this activity. For instance, you can check out http://phrogz.net/JS/Tabtastic/index.html#overview or http://www.dynamicdrive.com/dynamicindex17/tabcontent.htm and see if those help you out at all. Aside from that, you can look for help with Javascript ".innerHTML" and see if that helps you. Let us know, and good luck!!
     
  3. johnnyoak

    johnnyoak New Member

    hey! thank you for the help...i tried doing that and i am totally confused : /
    any additional information would be greatly appreciated! (i don't know anything about JS or CSS...only basic HTML etc) .... here is what i have so far - http://www.johnnyoak.com/rough.html

    i'm using dreamweaver, and when i preview it in IE, i am getting something like this - http://i61.photobucket.com/albums/h53/joak928/website/website.gif

    it looks as if the title/banner is covering the top toolbar for some reason....any help resolving this would be great as well!

    thanks!!

    johnny
     
  4. TheJester

    TheJester New Member

    OK, I am going to separate this question into 2 parts, so the answers make more sense.

    1.) To target your DIV with Recent News, you would do something like this:

    First, you address your DIV with it's name in code to display your initial data:
    <div id="left">
    ...

    Next, you will use JS on your links/buttons (via onClick with buttons, and the target for a link button) to change the text of "left", something like this:

    document.getElementByID('left').innerHTML="My new text."

    So, for example: to make the contents of your "About" button display here you could use this code:

    <a href="javascript:{}" onClick="document.getElementByID('left').innerHTML='All About Me'">About</a>

    2.) For your banner display issue, I can probably help you more but I need for you to make that page active so I can do things like "View Source". Save it to your server as something like "rough2.html" or some equivalent. Once that is done, let me know and I will have a look.

    Hope that helps you so far. Let me know about the JS code above, and if that works for you or not... good luck!