Hi,

When i clicked the submit button, it must be open an image and write a text like "Please wait". Then they will be hide after 5 seconds and we will see the submit button results. Can you help me about that?

Recommended Answers

All 4 Replies

Your question is very vague. Even though I do not really want to help you but it turned out to be quite an unexpected good exercise. A sample code is below...

<html>
<head>
<script type="text/javascript">
function displaySomething(aID, formID) {
  var el = document.getElementById(aID)
  if (el) {
    el.style.display = null
    el.style.visibility = null
    el.style.zIndex = 1
    el.style.opacity = 1
    window.setTimeout("hideSomething('"+aID+"','"+formID+"')", 5000) // 5 seconds
  }
}

// expect existence of aID && formID
function hideSomething(aID, formID) {
  var el = document.getElementById(aID)
  if (el.style.opacity>0) {  // fading effect
    el.style.opacity = (parseFloat(el.style.opacity)-0.2)
    window.setTimeout("hideSomething('"+aID+"','"+formID+"')", 120)
  }
  else {
    el.style.display = "none"
    el.style.visibility = "hidden"
    el.style.zIndex = 0
    document.getElementById(formID).submit()
    return false
  }
}
</script>
</head>

<body>
<form id='aForm'>
  <div id="stuffToShow" style="display:none;visibility;hide;position:absolute;top:100px;left:90px;font-size:32px;font-weight:bold;color:red;text-align:center;">
  Please WAIT!!!
  </div>
  <div style="border:2px solid gray;width:400px;height:300px;top:10px;text-align:center">
  <br /><br /><br /><br /><br /><br />
  ...Working Area...&nbsp;
  </div>
  <br />
  <input type="button" value="OK" onclick="displaySomething('stuffToShow', 'aForm')">
</form>
</body>
</html>

That is exactly what i want to do! Thanks man, thank you very much!

<input type="image" src="/button.gif" width="100" height="50"...

When i changed the button with image, it wasn't working. I will use image button. What can i do for this?

There is no such thing as

<input type="image" ...>

Change entire tag to and <img> tag something like this:

<img src="/button.gif" onclick="displaySomething('stuffToShow', 'aForm')">
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.