Jump to content

Load text dynamically depending on button press?


lazerbrains

Recommended Posts

I have a site that I have an about page with pictures of people on it. I would like to create something that would do the following:

 

* When you click on one of the images, i need text for that image to load in a text area.

 

I would like to do this rather than have to make a different HTML page for each person, but I am not sure how to go about doing it. I do not have a database for this site, so I will need to pull the text from a text file or something like that.

 

Any ideas on how to get started would be helpful.

 

Thanks in advance!

 

 

Link to comment
Share on other sites

This isn't really a php question but more for JavaScript especially if you aren't wanting the page to reload all of the time. I use what is called jQuery and I have a few pages for you to look at and maybe you can sort out what you want to do.

 

http://api.jquery.com/click/

 

http://api.jquery.com/show/

 

http://api.jquery.com/hide/

 

If you aren't wanting to use a database and aren't wanting to use files you can place all of your information that you want hidden in a div and "hide" it until a user "clicks" on the image and that would trigger the "show" if you were wanting to run from files I would look into jquery's post function but then you are getting into using an xml or json return which might just be overkill unless you have a ton of data.

 

Look at the code on this page too. It is for a tabbed menu but the same concepts can be utilized and the code is easy to sort out.

 

http://yensdesign.com/2008/12/create-a-smooth-tabbed-menu-in-jquery/

 

and here is one that explains what is happening in the jquery a little better and talks about jquery post

 

http://www.jasonbrennan.com/jquery/jquery-ajax-or-is-it-jquery-json/

 

Sorry about the rambling. I hope this gets you started. I may be a little slow to respond but I will get back to you.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.