SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Member
    Join Date
    May 2002
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    need script for populating stories to page

    Hi

    I'm trying to have a section on my page to change stories when a link is clicked but I don't want to have to create separate index.html pages. Here's the gist of it.

    I have a index.html page. On that page I feature a main story. There's also two other feature stories that can be viewed if you click "2" or "3". But the stories are just in a small area of my whole page so I don't want to have to create an index2.html and index3.html.

    Initially, I'd like to know if there's a way to keep the index.html page. And when the visitor clicks on "2" to view the feature 2 story in this same little box on the index.html...the content changes but the url is still index.html.

    My site is in html ... so I'm wondering if there's some external script file or something of the like that can get this done....or am I just dreamin'!?

    Butta

  2. #2
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I would consider investigating SSI (Server Side Includes) for incorporating different content into your page on mouse click as it will keep your initial page size down.

    However, here's a quick and dirty way that shows how you can do what you're looking for all in one document (uses Javascript):

    Click me for demo


    Hope it's what you're looking for,

    Andy
    http://recommendedby.andywestmoreland.com
    From the English nation to a US location.

  3. #3
    SitePoint Member
    Join Date
    May 2002
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    AWESOME! You're a lifesaver! This is exactly what I wanted to do!!!

    Thanks for your help Andy

  4. #4
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Glad it was useful

    If you need any of the code explaining so that you can add/remove your own stories then feel free to ask.
    From the English nation to a US location.

  5. #5
    SitePoint Member
    Join Date
    May 2002
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    DARN! This doesn't work in Netscape 4.7..and that's what I need it to work in unfortunately!

    Can this same task be done with external .js files?

  6. #6
    American't awestmoreland's Avatar
    Join Date
    Sep 2002
    Location
    Grand Rapids, MI
    Posts
    1,168
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Oops! Let me have a look at it tomorrow and I'll stick a few IF statements in there to cope with prehistoric browsers.

    When you say external .js files, I think that you really mean server-side js (or at least some kind of server side scripting). It could be done quite easily using something like PHP but that would require the page to be reloaded to take effect.

    Not a major problem, but seems overkill.
    From the English nation to a US location.


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
  •