Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New Coder
    Join Date
    Feb 2012
    Posts
    99
    Thanks
    1
    Thanked 5 Times in 4 Posts

    Need help please.

    I have a drop menu and i want a image to change when a option is chosen form it. It's a search engine website and people can choose from the drop menu if they want to use "google search" or other ones. When they choose one from the drop menu then i want the image on top of the search box to change to the logo of the search engine they chose. 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.

  • #2
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    333
    Thanks
    2
    Thanked 47 Times in 46 Posts
    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.
    Last edited by Redcoder; 09-16-2012 at 07:33 AM.

  • #3
    Banned
    Join Date
    Sep 2012
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    is the best method a combination of js and php?

  • #4
    Regular Coder Redcoder's Avatar
    Join Date
    May 2012
    Location
    /dev/null
    Posts
    333
    Thanks
    2
    Thanked 47 Times in 46 Posts
    Quote Originally Posted by Webpeak View Post
    is the best method a combination of js and php?
    Personally...I prefer the combination of JAVASCRIPT and PHP using AJAX to load the needed files like images because it's easier and faster to apply to the web application architecture. Also the app perfomance is good and there are no page refreshes needed as the needed stuff is loaded in the background.


  •  

    Posting Permissions

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