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 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Ajax Page Fetcher Question

    I've got an image that changes whenever you select a different item from a select box. When I use the Ajax Page Fetcher it shows the default image and not the image that was selected from the select box.

    Is there any way to edit the code to show the image selected? Here's the url for what I'm doing:http://har**villedesign.com/har**villedesign/gil_u_d.html (delete the ** in the url. I only have the first few clickable at this point.

    Any help is appreciated!

  • #2
    WA
    WA is offline
    Administrator
    Join Date
    Mar 2002
    Posts
    2,596
    Thanks
    2
    Thanked 19 Times in 18 Posts
    Hmm I'm not too sure where I should be looking on the link you provided for an example of the issue. Anyhow, if the select menu is on the external page being fetched by Ajax, it may not work once transferred over to the main page, as it's powered using JavaScript I assume, and Ajax isn't always able to fully migrate the script from the external page to the main. That's why Ajax Page Fetcher also supports dynamic loading of .js files (see script page), which may be the solution for you.
    - George
    - JavaScript Kit- JavaScript tutorials and 400+ scripts!
    - JavaScript Reference- JavaScript reference you can relate to.

  • #3
    Regular Coder
    Join Date
    Nov 2007
    Location
    Leeds, UK
    Posts
    514
    Thanks
    24
    Thanked 19 Times in 19 Posts
    dont use AJAX for that have some thing like this
    Code:
    <script type="text/javascript">
    function images(img)
    {
      document.getelementbyid('image').src = img;
    }
    </script>
    Your Image code
    Code:
    <img src='' id="image" onload="images('*default image*');" />
    Then have onclick or onhover affect on the trigers that run image('*image Address*');

    I hope this works for you if you are wanting it to get the images addresses from a DB have some thing like this
    Code:
    $query = mysql_query('SELECT (img, ID) FROM `Images`)
    echo '<script type="text/javascript">';
    while($row = mysql_fetch_array($query))
    {
    echo 'var image['.$row['ID'].'] = "'.$row['img'].'";
    }
    echo '</script>'
    I hope this helps u and the last code bit is PHP
    Last edited by barkermn01; 01-14-2008 at 10:32 PM.


  •  

    Posting Permissions

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