Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Jan 2008
    Posts
    2
    Member #
    16366
    Hi there, new to the forums... I'm not very good with js (yet), and my question sorta has to do with javascript as well as php and html, hope I'm posting this in the right place

    I am basically trying to put a load message on while the images in a gallery load. Getting this to happen seems to be pretty easy, found some decent scripts... I liked this one in particular, as it's so simple an straightforward. The problem is all the scripts seem to want to use the <body> tag, and I don't want the whole page not to load, just a part of it - specifically a few html tables a small php script.

    I have it setup so that the gallery code is contained in a .php file that is 'include'd, so it's essentially its own page. However, inserting a body tag into this doesn't seem like a solution.

    Not sure what the best approach to this would be, any suggestions? Any help would be appreciated, thanx

  2.  

  3. #2
    Senior Member
    Join Date
    May 2003
    Location
    UK
    Posts
    2,354
    Member #
    1326
    If I understand you, you can just have the function call inside <script></script> tags and not in the <body> tag.

    Something like
    HTML Code:
    <script type="text/javascript">
    
    // functions here
    
    waitPreloadPage();
    
    </script>
    
    </head>
    
    <body>

  4. #3
    Junior Member
    Join Date
    Jan 2008
    Posts
    2
    Member #
    16366
    Hi there, thank you for the quick reply, sorry I couldn't get back to you right away...

    That MIGHT be part of a fix, but I'm not sure if that lets me do what I want it to... Here, I'll try and provide an example.
    ------------------------------
    <html>
    <head>
    <script>script is defined here</script>
    <head/>
    <body>
    now a table with two columns...
    <table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
    <td><?php include (gallery.php);> ?></td> here's where the gallery loads in
    <td>Click on the pics to enlarge!</td> some example text
    </tr>
    </table>
    </body>
    </html>
    -----------------------------
    gallery.php is a page with some tables and script defining the gallery output from a mysql source. This could have just as easily been done just putting the table and stuff directly in the code (which it essentially does, thru the 'include')

    Now, how do I get the load to execute the "please wait" script for just the gallery part, while leaving the rest of the page alone (so in the example, you would see the 'Click pics to enlarge!' on the right, while the gallery loading message is displayed in the left column)? Can I somehow put another <body> into gallery.php (doesn't seem right), or can I call the script thru another tag... I was thinking maybe I could put it directly into a table or something? Keep in mind I'm trying to use this script, which wants to be put into the body tag. I'm not married to it, if I can use a different script to achieve this then that's fine too.

    Thanx

  5. #4
    Senior Member Shani's Avatar
    Join Date
    Nov 2004
    Posts
    1,140
    Member #
    8171
    Wow! That was written for Netscape4 and IE4! Maybe consider using a different (ahem, newer) script?

    Any how... in Javascript you can use getElementByID('gallery') and it should put you on the right path. Don't forget to add that id to your td.
    Shani

    I have an eye for detail like you'd never believe.

  6. #5
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    The problem is that the page does not load separately. When you use a PHP [minicode]include[/minicode] directive, the pages are included on the server, and by the time it makes it to the browser it is considered one big page. So there's no way to discern the loading of the gallery area from the loading of the rest of the page.

  7. #6
    Senior Member imagn's Avatar
    Join Date
    Jul 2007
    Location
    Los Angeles
    Posts
    156
    Member #
    15594
    Sounds like you'll want to use AJAX to load an external page...

    I've got some sample code from another project but I won't be able to post it for a day or so. In the mean time I did a quick Google search and the first hit was decent:

    http://www.dynamicdrive.com/dynamici...jaxcontent.htm

    This script doesn't contain the "waiting" message so you'd need to do another search on the code to add that into the above script. Hopefully this is enough to get you started.


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:24 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2020 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com