SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Evangelist Tecknowjnkie's Avatar
    Join Date
    Nov 2004
    Location
    Mission Viejo
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Explode content if users elects

    I am looking for a script or maybe some hints as to how to show say a snippet of content and if the user elects to read it, they can click and it pushes existing content down and displays full text.

    I am not versed well in Java, if possible keep in 1st grade syntax.

    Thank you

  2. #2
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This would be javascript, not java.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  3. #3
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    
    <html>
    <head>
    <title>My story</title>
    <script type="text/javascript">
    <!--
    function showMore()
    {
    //this function is what expands the article when the link is clicked.
      document.getElementById("more").style.display = 'block';
    }
    function setup()
    {
    //hide the div for those with JS enabled.
      document.getElementById("more").style.display = 'none';
    //set the link up so it runs the showMore() function
    //when it is clicked
      document.getElementById("morelink").onclick = showMore;
    }
    //run the setup function on page load.
    window.onload = setup;
    -->
    </script>
    </head>
    <body>
    <div id="everything">
    <h1>My article.</h1>
    <p>The first paragraph of the article.</p>
    <p><a id="morelink" href="#more">More...</a></p>
    <div id="more">
    <p>The rest of the article</p>
    </div>
    </div>
    </body>
    </html>
    Should be pretty self-explanatory really

  4. #4
    SitePoint Evangelist Tecknowjnkie's Avatar
    Join Date
    Nov 2004
    Location
    Mission Viejo
    Posts
    403
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you Vgarcia

    Sorry Defender 1

    <insert>
    I suspect all JS is not this easy - but wow you should have seen what I was attempted with MySql and PHP before bieng directed here.
    </inset>
    Last edited by Tecknowjnkie; Jan 14, 2005 at 12:36. Reason: further gratitude

  5. #5
    ☆★☆★ silver trophy vgarcia's Avatar
    Join Date
    Jan 2002
    Location
    in transition
    Posts
    21,235
    Mentioned
    1 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by Tecknowjnkie
    I suspect all JS is not this easy
    Definitely not, but once you get the hang of it nothing is too difficult either. Keep at it


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
  •