Results 1 to 3 of 3

Thread: showing an progress indicator

  1. #1
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default showing an progress indicator

    hi
    i don't know anything about javascript.
    i want to do that;
    there is a submit button. that sends a file to my server.
    i want it to display loading.gif when i pressed the submit button.

    for example this is my html code
    PHP Code:
    <input type="button" onclick="ShowImage('loading.gif')" value="Submit"
    when i press "Submit" it should display loading.gif

    the problem is i don't know how can i code the ShowImage function.
    please help
    thanks.

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Try this (in the head of the document):

    Code:
    <script type="text/javascript">
     function ShowImage(img) {
    
    var obj = document.getElementById('imgDiv');
    
    obj.innerHTML = '<img src="'+img+'" alt="Loaded Image">';
     }
    </script>
    Then, wherever you want the image to show up (when you click on the button), place this:

    Code:
    <div id="imgDiv"></div>
    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    May 2007
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    thanks a lot ))

Bookmarks

Posting Permissions

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