Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8782009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:27:24+00:00 2026-06-13T20:27:24+00:00

OK, I submitted a question a little while ago pertaining to an animated loading

  • 0

OK, I submitted a question a little while ago pertaining to an animated loading GIF not displaying while an image is uploading ( PHP ). Now, I’ve managed to get the GIF to display while an image is uploading, but in IE and Firefox the loading GIF never goes away ( and / because ? ) the form never submits. In Chrome, the GIF goes away and the form submits. The following is what I have doing it..

<!-- Validates form -->
<script type="text/javascript" src="jquery-1.8.0.js"></script>
<script>
function validationloading(){
    // post box blank
    var x=document.forms["livefeed"]["message"].value;
    if (!$.trim($("#styled").val())){
        document.livefeed.message.focus();
        document.livefeed.message.style.border="solid 1px red";
        alert("Cannot post a blank message.");
        return false;
    }

    document.write("<table cellpadding='0' cellspacing='0' border='0' align='center' width='100%' height='130'><tr><td align='center' valign='center'><img src='images/ajax_loader.gif' width='50' height='50'></td></tr></table>");
    return true
    $("#myform").submit();
}
</script>

The following snip is what calls it from the form..

onSubmit="javascript: validationloading()" 

I’ve tried shuffling the return true value around and it changes the results but not in the way I need. It’ll submit in IE and Firefox but not display the loading GIF. I know my code is a pile of slop, but that’s why I’m here.

The following works 100% across the three browsers.. I appreciate all your help, guys !

<!-- validates form and displays loading gif -->
<script type="text/javascript" src="jquery-1.8.0.js"></script>
<script>
function validationloading(){
    // post box blank
    var x=document.forms["livefeed"]["message"].value;
    if (!$.trim($("#styled").val())){
        document.livefeed.message.focus();
        document.livefeed.message.style.border="solid 1px red";
        alert("Cannot post a blank message.");
        return false;
    }
    //

    document.livefeed.submit(); 
    document.getElementById("gif_block").style.display="block"; //gif_block is the id of the div outside the image
    document.getElementById('livefeed').style.display ='none';
    return true;

}
</script>

and the GIF div is this..

<div id="gif_block" style="display:none" align="center" ><p><image src="images/ajax_loader.gif" id="loader-img" width="50" height-"50" /></p></div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:27:25+00:00Added an answer on June 13, 2026 at 8:27 pm

    There are a few things wrong with your code:

    • javascript: is only meaningful in href or action attributes – basically wherever you might find a URL. It is a scheme to indicate JavaScript code to be run. In an event handler or a <script> tag, it’s just a label that you might use as part of a loop.
    • return always ends execution of the current block, so it makes absolutely no sense to return true and then try to $("#myform").submit();.
    • In fact, that $("#myform").submit() is potentially dangerous in that it may well cause an infinite loop: by submitting the form within its own onSubmit handler, you fire the handler again and try to submit the form anew, and so on.
    • document.write() will overwrite the entire page if it’s not being called while the page is loading. While in this case that’s not really too much of an issue, I’m fairly sure it’s not what you were intending to do.
    • document.forms is obsolete, you should instead use proper DOM methods like getElementById. However in this case you could just pass this as an argument to validationloading and it will refer to the form being submitted. I’m assuming this is similar to why you have document.livefeed.message – use getElementById for these.
    • You never actually do anything with the return value of the function. You need to return it up the stack: onSubmit="return validationloading();"

    The number one issue is the document.write thing. Remove that and the .submit() after it, and everything will be fine. There’s no need to add a “loading” GIF unless you’re using AJAX.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I submitted my app to the iTunes App Store for approval a little while
I had much luck last time I submitted a question so here goes: I
So, I submitted an answer to this SO question about redirecting your site ,
weird question. I'm trying to extend a little plugin that's in my blog's sidebar.
I'm having a little trouble defining my question. Here's what I have. A mailto
I submitted a question on 'prototype scope' and wanted to know the reason for
I just submitted this question but i can't see if it posted anywhere, so
I have to use a picture, Stackoverflow says: Oops! Your question couldn't be submitted
I have a question regarding the $_REQUEST global variable in php. When you have
I submitted another version of this question and a sample program before: How do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.