View Single Post
Old 09-16-2012, 07:24 AM   PM User | #2
Redcoder
Regular Coder

 
Redcoder's Avatar
 
Join Date: May 2012
Location: /dev/couch
Posts: 309
Thanks: 2
Thanked 46 Times in 45 Posts
Redcoder has a little shameless behaviour in the past
Quote:
Originally Posted by bigcasey123 View Post
I have a drop menu and i want a image to change when a option is chosen form it.

Can this be done with php or do i need javascript? I already downloaded the logos so now i just need them to change when a option is chosen.


To answer your original question concisely: you'll have to use Javascript no matter how small as you'll need it to capture the drop-down event.

You can use a combination of PHP and Javascript by using AJAX to load the images using a back-end PHP script when needed - that is if you don't want the page to refresh inorder to load a new search-engine service. Then also use Javascript to change the search-engine URL target.

You can also use Javascript alone but you'll have to pre-load a lot of the involved stuff like Images to the browser which may take more time than just using AJAX to load them. Although you can just load maybe the most used search engine first then after the DOM is ready and the user can interact with the site, proceed to load the images and other needed stuff to the cache in the background.

I think using a combination of Javascript -AJAX - PHP is the best. It will make initial page load faster.
__________________
For professional Hosting and Web design.....


NetEssentials.co.uk

Last edited by Redcoder; 09-16-2012 at 07:33 AM..
Redcoder is offline   Reply With Quote