Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3

Thread: need some help!

  1. #1
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cool need some help!

    Alright. I need some help.
    Im not sure if javascript is going to help me here, but hopefully someone could assist me.

    Here's what i need...
    - I need to display information in groups. For example, I have products that I want to show. I have the name of the product and then the details of the product.
    - However, I want to show just the product name initially with a [+] next to the product name that they can click to see more information on the product.
    - When they click the [+] I want the information to display below the product name without having to reload the page.

    Can anyone help me get started/ direct me in the right direction?!
    Thanks!

    Chris

  • #2
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    So you will have the product info already loaded onto the page correct?
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>Untitled Document</title>
    <style type="text/css">
    #description {
    font-family:Verdana, Arial, Helvetica, sans-serif;
    font-size:0.9em;
    }
    a#more {
    text-decoration:none;
    color:#000;
    display:block;
    float:left;
    width:2em;
    text-align:center;
    background-color:inherit;
    outline:0;
    }
    a#more:hover {
    color:#F00;
    }
    #moreinfo {
    text-indent:2em;
    }
    </style>
    <script type="text/javascript">
    function showInfo()
    {
    	document.getElementById('moreinfo').style.display = (document.getElementById('moreinfo').style.display == 'none') ? 'block' : 'none';
    	document.getElementById('more').childNodes[0].nodeValue = (document.getElementById('more').childNodes[0].nodeValue == '[+]') ? '[-]' : '[+]';
    	return false;
    }
    window.onload = function()
    {
    	document.getElementById('moreinfo').style.display = 'none';
    }
    </script>
    </head>
    <body>
    <div id="description"><a href="#" onclick="return showInfo()" id="more">[+]</a> This is a brief summary of the product.
    	<div id="moreinfo">This is a longer summary of the product mentioned above.</div>
    </div>
    </body>
    </html>
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #3
    New to the CF scene
    Join Date
    Sep 2006
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Thumbs up

    thats it! thanks!


  •  

    Posting Permissions

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