Current location: Hot Scripts Forums » General Web Coding » JavaScript » [SOLVED] Change content in a DIV with links in another DIV


[SOLVED] Change content in a DIV with links in another DIV

Reply
  #1 (permalink)  
Old 05-04-08, 04:24 AM
s1yfa's Avatar
s1yfa s1yfa is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Sheerness, Kent UK
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
[SOLVED] Change content in a DIV with links in another DIV

I have spent hours trying to find something suitable to change content in a single DIV by clicking links or buttons in a separate DIV.

Let me explain, I have a table, one row tall and two columns wide. In the left hand cell I want to have a DIV containing a list of manufacturers, which when clicked, will display a short description of that manufacturer with their logo and a link to their website in a DIV in the right hand cell.

I have seen some great scripts to show/hide content in a DIV, but each links has to have its own DIV to display the content, because it gets the text/images from code in the same page I presume?

Is there a way I can do this using a separate file to retrieve the content from?

Any help would be appreciated.

Thanks
Chris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-04-08, 04:30 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
Yes, that is possible. It's a technique called AJAX. When you click a link of a manufacturer, you execute some Javascript code which fetches the content of a page you specify, and then you can display that content in a div.

Maybe this will be a helpful link: http://www.w3schools.com/Ajax/Default.Asp
__________________
Jack Bauer makes Chuck Norris cry
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-04-08, 04:45 AM
s1yfa's Avatar
s1yfa s1yfa is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Sheerness, Kent UK
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
see I figured using XMLHttpRequest, but if Im pulling content from an XML file, can I use images too? I though xml only contains text?

Chris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 05-04-08, 05:10 AM
s1yfa's Avatar
s1yfa s1yfa is offline
Newbie Coder
 
Join Date: Dec 2005
Location: Sheerness, Kent UK
Posts: 39
Thanks: 0
Thanked 0 Times in 0 Posts
actually, I found this: http://www.dynamicdrive.com/dynamici...tentglider.htm

a bit more complex than what I was originally going for, but i can modify that to work for me. It looks like quite a powerful script so hopefully will be of use to others.

Chris
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't Understand java script maverickminds JavaScript 1 07-16-06 02:23 PM
PHP/MySQL Script sszukala Job Offers & Assistance 0 01-28-06 03:53 PM
How can I change and then restore a links content using onClick. Joe_Bloggs JavaScript 2 09-22-05 09:18 AM
Change width of div if another div is not present hockeykid JavaScript 2 12-08-04 08:27 PM
Error On Registeration timmy408 ASP 2 09-05-04 03:53 PM


All times are GMT -5. The time now is 10:28 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.