SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Zealot
    Join Date
    May 2002
    Location
    Oslo
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Show image when pressing submit button in form

    When pressing the submit button in a form, I need a script that shows an image (gif) embedded in the form. The image must be invisible until the submit button is pressed.

  2. #2
    SitePoint Guru
    Join Date
    May 2004
    Location
    santa rosa, ca
    Posts
    969
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    try onsubmit="document.getElementById('imgId').display='inline';"

  3. #3
    masquerading Nick's Avatar
    Join Date
    Jun 2003
    Location
    East Coast
    Posts
    2,215
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, first to hide you image, you need to have it set at display:none

    Code:
    <img src="image.gif" name="myImage" style="display:none;">
    Then, onSubmit, change the display.

    Code:
    <script language="javascript">
    function showImage() {
      var image = document.getElementById('myImage');
      image.style.display = '';
    }
    </script>
    Code:
    <form onSubmit="return showImage();">
    [...]
    </form>
    That should do the trick
    Nick . all that we see or seem, is but a dream within a dream
    Show someone you care, send them a virtual flower.
    Good deals on men's watches


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
  •