Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 10 of 10
  1. #1
    Junior Member
    Join Date
    Feb 2010
    Posts
    15
    Member #
    21201
    I知 working on a web page in dreamweaver, this webpage is a catalog structure web page. I知 trying to figure out how to make the text change when a different product is clicked on, for instance when image 1 is clicked on I want it to say card 1, when image 2 is clicked on I want it to say card 2. Does any one have any suggestions on how to accomplish this?

  2.  

  3. #2
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    php or javascript. probably javascript would be best.

    while($get_it !== true){ continue; }

  4. #3
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    It depends on if the new text will appear on the same page (say, as a tooltip or expanded detail) or if on a different page (e.g. a products detail page). Javascript for the former, PHP or another server-side language for the latter. I'm guessing it's the second though.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  5. #4
    Senior Member Dorky's Avatar
    Join Date
    Jun 2009
    Location
    Destin Florida
    Posts
    1,430
    Member #
    19103
    Liked
    4 times
    hmm
    for instance when image 1 is clicked on I want it to say card 1, when image 2 is clicked on I want it to say card 2

    while($get_it !== true){ continue; }

  6. #5
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    You never know. That does apply to switching pages too, Mini never specified if there needed to be a page refresh. I'm just guessing so because it was a "catalog structure". Really depends on what is needed, though.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  7. #6
    Junior Member
    Join Date
    Feb 2010
    Posts
    15
    Member #
    21201
    Thanks.

  8. #7
    Junior Member
    Join Date
    Feb 2010
    Posts
    15
    Member #
    21201
    I知 not sure how to use java script yet, it seems complicated, is there a way to use it in dreamweaver that is relatively simple. I知 not trying to get out of doing hard work, it痴 just that at this point, where I am at currently I just need to know where to start. Can anyone point me in the direction to use through dreamweaver that will make this text change to occur?

  9. #8
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Just to be sure, Mini, do you intend for this text change to occur on the same page, or after a page refresh (different page)?

    Javascript is a scripting language. There is pretty much no other way to make it aside from hand coding or using template scripts. On the other hand, Javascript is one of the simpler languages to learn, is fairly forgiving, and can access browser plugins like Firebug to help you debug it.

    If you're willing to learn, check our jQuery, I think it should get you there fastest.
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.

  10. #9
    Junior Member
    Join Date
    Feb 2010
    Posts
    15
    Member #
    21201
    Yes, I'd like for the text change to occur on the same page. Thanks for the advice. I definitely want to learn it, I'm just not sure how fast I'll be able to. Thanks for the jQuery link!

  11. #10
    Senior Member Steax's Avatar
    Join Date
    Dec 2006
    Location
    Bandung, Indonesia
    Posts
    1,207
    Member #
    14572
    Here's a quick hint in case you need it.

    HTML side:
    HTML Code:
    <p id="dynamic">Item Number</p>
    <ul id="items">
    <li><a href="#" title="Item 1">This is the first item</a></li>
    <li><a href="#" title="Item 2">A second item</a></li>
    <li><a href="#" title="Item 3">An item after that</a></li>
    <li><a href="#" title="Item 4">Finally, a fourth item</a></li>
    </ul>
    It makes use of the title attribute, since it also fits the purpose of a tooltip.

    And javascript:
    Code:
    $(function(){ // leave this line be, it tells the code to function as soon as the page is ready
    
    // the following is a selector, like in CSS, and using that selector we do a
    // jQuery selection, and then apply a click event to it
    $("#items li a").click(function(){
       var itemname = $(this).attr("title"); // gets the item name
      $("#dynamic").html(itemname); // change the HTML contents of the dynamic field
      return false;  // cancel the click event
    });
    
    }); // leave this line be
    Note on code: If I give code, please note that it is simply sample code to demonstrate an effect. It is not meant to be used as-is; that is the programmer's job. I am not responsible to give you support or be held liable for anything that happens when using my code.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:36 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com