www.webdeveloper.com
Results 1 to 3 of 3

Thread: Display a grapic - I know it's simple, but I just can't get it to work

  1. #1
    Join Date
    May 2007
    Posts
    48

    Display a grapic - I know it's simple, but I just can't get it to work

    Right now I've got a terrible sinus condition so my brain probably isn't functioning properly. I'm hoping someone will take pity on me and help me out.

    I've got a simple HTML page used to specify files for uploading. The uploading is done with a PHP routine. It works fine except that larger files take a long time. I just want to display an animated 'wait' gif while the php file processes. I want it to display in the middle of the page (not in a new window) when the Submit button is clicked (after checking to make sure the userid and password have been entered). I know that's simple, but I just can't get it to work. Here's the HTML code. I've put in a comment where (when) I want the graphic to display.

    HTML Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
      <title>File Upload Page</title>
    <script type="text/javascript">
    function checkrequired(which) {
    var pass=true;
    if (document.images) {
    for (i=0;i<which.length;i++) {
    var tempobj=which.elements[i];
    if((tempobj.name == "user" || tempobj.name == "passwd") && tempobj.value=='') {
    pass=false;
    break;
         }
       }
    }
    if (!pass) {
    shortFieldName=tempobj.name.substring(0,30).toUpperCase();
    alert("Please enter your Username and Password");
    tempobj.focus();
    return false;
    }
    else
    
    // DISPLAY GRAPHIC NOW
    
    return true;
    }
    </script>
    </head>
    
    <body>
    <p>&nbsp;<p>
    <p>
    <font size=+2>
    <center>
    Welcome to the File Uploader.
    <p>&nbsp;<p>
    <table align="center" valign="middle" border=2>
    <tr><td>
    <table border=0>
    <tr>
    <td align="center">
    <form enctype="multipart/form-data" action="uploader.php" method="post" onsubmit="return checkrequired(this);">
    <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
    <p>Select up to five files to upload.<br>File size must be less than 2.4MB.<br>
    <input name="graphicfile[]" type="file" size=40 value=""><br>
    <input name="graphicfile[]" type="file" size=40 value=""><br>
    <input name="graphicfile[]" type="file" size=40 value=""><br>
    <input name="graphicfile[]" type="file" size=40 value=""><br>
    <input name="graphicfile[]" type="file" size=40 value=""><br>
    
    </td>
    </tr>
    <tr height=20><td align="center" valign="middle"><u>User Authorization</u></td>
    </tr>
    <tr><td>Username: <input type='text' name='user' >  Password: <input type='password' name='passwd'>
    <br><center>Note: Both Username and Password are case sensitive.</td>
    </tr>
    <tr height=40><td align="center" valign="bottom">
    <input value="Upload Files" type="submit"></p></td>
    </form>
    </table>
    </td></tr></table>
    </body>
    Thanks,

  2. #2
    Join Date
    Jun 2004
    Location
    Portsmouth UK
    Posts
    2,709
    Code:
            <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
            <html>
            <head>
              <title>File Upload Page</title>
    <style type="text/css">
    <!--
    
    .mask {
      position:fixed;z-Index:101;visibility:hidden;left:0px;top:0px;width:100%;height:800px;
    }
    
    .mask IMG {
      position:absolute;
    }
    
    -->
    </style>
    
    <script type="text/javascript">
            function checkrequired(which) {
            var pass=true;
            if (document.images) {
            for (i=0;i<which.length;i++) {
            var tempobj=which.elements[i];
            if((tempobj.name == "user" || tempobj.name == "passwd") && tempobj.value=='') {
            pass=false;
            break;
                 }
               }
            }
            if (!pass) {
            shortFieldName=tempobj.name.substring(0,30).toUpperCase();
            alert("Please enter your Username and Password");
            tempobj.focus();
            return false;
            }
            else
    
            // DISPLAY GRAPHIC NOW
             var msk=document.getElementById('mask'),img=msk.getElementsByTagName('IMG')[0];
             img.style.left=(msk.offsetWidth-img.offsetWidth)/2+'px';
             img.style.top=(msk.offsetHeight-img.offsetHeight)/2+'px';
             msk.style.visibility='visible';
    
            return true;
            }
            </script>
            </head>
    
            <body>
            <p>&nbsp;<p>
            <p>
            <font size=+2>
            <center>
            Welcome to the File Uploader.
            <p>&nbsp;<p>
            <table align="center" valign="middle" border=2>
            <tr><td>
            <table border=0>
            <tr>
            <td align="center">
            <form enctype="multipart/form-data" action="uploader.php" method="post" onsubmit="return checkrequired(this);">
            <input type="hidden" name="MAX_FILE_SIZE" value="3000000" />
            <p>Select up to five files to upload.<br>File size must be less than 2.4MB.<br>
            <input name="graphicfile[]" type="file" size=40 value=""><br>
            <input name="graphicfile[]" type="file" size=40 value=""><br>
            <input name="graphicfile[]" type="file" size=40 value=""><br>
            <input name="graphicfile[]" type="file" size=40 value=""><br>
            <input name="graphicfile[]" type="file" size=40 value=""><br>
    
            </td>
            </tr>
            <tr height=20><td align="center" valign="middle"><u>User Authorization</u></td>
            </tr>
            <tr><td>Username: <input type='text' name='user' >  Password: <input type='password' name='passwd'>
            <br><center>Note: Both Username and Password are case sensitive.</td>
            </tr>
            <tr height=40><td align="center" valign="bottom">
            <input value="Upload Files" type="submit"></p></td>
            </form>
            </table>
            </td></tr></table>
            <div id="mask" class="mask" >
             <img src="http://www.vicsjavascripts.org.uk/StdImages/1.gif" alt="loading">
            </div>
            </body>
    Vic

    God loves you and will never love you less.

    http://www.vicsjavascripts.org/Home.htm
    If my post has been useful please donate to http://www.operationsmile.org.uk/

  3. #3
    Join Date
    May 2007
    Posts
    48
    Vic.

    Many thanks. It works great. One thing, I adjusted the top and left values so my graphic would fall in the middle of the window.

    HTML Code:
      position:fixed;z-Index:101;visibility:hidden;left:500px;top:200px;width:100px;height:100px;
    It does in everything but IE. Does IE require a different style definition?

    Thanks again.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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

"

"

X vBulletin 4.2.2 Debug Information

  • Page Generation 0.12711 seconds
  • Memory Usage 2,879KB
  • Queries Executed 15 (?)
More Information
Template Usage (34):
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (1)bbcode_code
  • (2)bbcode_html
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (3)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (3)postbit
  • (3)postbit_onlinestatus
  • (3)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (72):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates