+ Reply to Thread
Results 1 to 5 of 5

Thread: Change image on Same PHP page

  1. #1
    agroup's Avatar
    agroup is offline x10 Sophmore agroup is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    190

    Change image on Same PHP page

    Hi

    i am working on a script. i am creating a script page.
    i want to show a pic on the page and have to give some links of other images

    so that the user click on the link and the image change without changing page.

    in other words the image change and the page remain same.

    Can you help me?

    I need this urgently . Thanx
    Last edited by agroup; 03-01-2009 at 05:25 AM.
    Regards:
    Agroup :cool:

    http://FileTube.info - Online File Storage & CMS Scripts
    Islamic-World - All About Islam

  2. #2
    mephis's Avatar
    mephis is offline x10Hosting Member mephis is an unknown quantity at this point
    Join Date
    Aug 2008
    Location
    London, UK
    Posts
    39

    Re: Change image on Same PHP page

    you'll need to use javascript to do that.

    example:
    Code:
    <div id="main_image">
        <img id="my_image" src="image1.jpg" />
    </div>
    <div id="thumbs">
        <img src="thumb2.jpg" onClick="change_image('image2.jpg')" />
        <img src="thumb3.jpg" onClick="change_image('image3.jpg')" />
        <img src="thumb4.jpg" onClick="change_image('image4.jpg')" />
    </div>
    <script language="javascript">
    function change_image(img) {
        document.getElementById('my_image').src = img;
    }
    </script>
    (I'm pretty certain this code will work, but give it a try first)

  3. #3
    xav0989's Avatar
    xav0989 is offline Community Public Relation xav0989 is just really nice
    Join Date
    Jul 2008
    Location
    ifk
    Posts
    4,438

    Re: Change image on Same PHP page

    As mephis said, the only way to do what you asked is through javascript/AJAX.
    BTW, the code you typed looks pretty valid to me!
    Xavier L | Community Public Relations Manager (Free Hosting Support)
    █ Yes, my position is too cool to even exist!
    How am I helping? Rate this post by clicking the icon below! (this is even better than "liking" a post)
    Terms of Service | Acceptable Use Policy | x10Hosting Wiki

  4. #4
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: Change image on Same PHP page

    xav0989, why do you point out the obvious? you don't need to restate something someone has already said. I've seen you do it a lot lately, and its very annoying.
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  5. #5
    agroup's Avatar
    agroup is offline x10 Sophmore agroup is an unknown quantity at this point
    Join Date
    Nov 2008
    Posts
    190

    Re: Change image on Same PHP page

    wow man
    it is working
    thankyou very much
    Regards:
    Agroup :cool:

    http://FileTube.info - Online File Storage & CMS Scripts
    Islamic-World - All About Islam

+ Reply to Thread

Similar Threads

  1. how to add x10 add code on a php page?
    By allinone in forum Scripts & 3rd Party Apps
    Replies: 1
    Last Post: 08-29-2008, 08:20 PM
  2. Displaying image using php mysql
    By gottaloveit in forum Programming Help
    Replies: 6
    Last Post: 05-08-2008, 10:49 AM
  3. Replies: 5
    Last Post: 04-06-2008, 12:47 PM
  4. PHP: Includes Tutorial
    By pulse__xx in forum Tutorials
    Replies: 14
    Last Post: 07-27-2006, 11:15 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers