www.webdeveloper.com
Results 1 to 2 of 2

Thread: Change paragraph with image click

  1. #1
    Join Date
    Jul 2006
    Location
    ERskineville Sydney
    Posts
    24

    Change paragraph with image click

    hey
    I am trying to find a solution to this:
    I want a grid of thumbnails on the left with text to the right that changes to the relevant text when you click on each thumbnail.
    Do I do this by CSS or with javascript as well?
    And whats the best way for all browsers
    thanks in Advance
    A

  2. #2
    Join Date
    Mar 2007
    Location
    USA
    Posts
    449
    This is really more of a javascript solution- have you used jquery? This would let you create a text area and then populate it with new text when clicking around on other elements on the page.

    Give these a try as a starting point:

    How to assign an element on a page a click:
    http://docs.jquery.com/Events/click

    Get and set text to html tags:
    http://docs.jquery.com/Attributes/text#val

    For both of these just click on the view source button on the page and it should show you how to use the script item, just make sure everything is inside the ready command like so:
    Code:
    $(document).ready(function(){
        alert('hello world');
    });
    Also you'll need to make sure you're loading the jquery library either locally or through google. If you go through google use this:
    Code:
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.0/jquery.min.js" type="text/javascript"></script>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles