简体   繁体   English

显示5秒后隐藏Div

[英]Hide Div after showing 5sec

What I want to achieve: 我要实现的目标:

  1. Hide Form Area after button click (DONE) 单击按钮后隐藏表格区域(完成)
  2. Show submit confirmation message on button click (DONE) 单击按钮后显示提交确认消息(完成)
  3. Hide Show submit confirmation message after showing it for 5 seconds 隐藏显示提交确认消息5秒后将其隐藏
  4. Show form area again 再次显示表单区域

I'm stuck on point 3 & 4 and would appreciate any hints. 我停留在第3点和第4点,不胜感激。 I have tried the set time out function but without luck.I must be doing something wrong. 我尝试了设置超时功能但没有运气。我一定做错了。

function hideDiv() {
               document.getElementById('FormArea').style.display = "none";
              }

function showDiv() {
              document.getElementById('submitarea').style.display = "block";
         }


setTimeout(function() {
    $('#submitarea').fadeOut('fast');
}, 1000); // <-- time in milliseconds

Does this solve your problem? 这样可以解决您的问题吗?

<input onclick="hidediv(); showdiv(); reshow();">

function hideDiv() {
    document.getElementById('FormArea').style.display = "none";
}

function showDiv() {
    document.getElementById('submitarea').style.display = "block";
}

function reshow(){
    setTimeout(function() {
        $('#submitarea').fadeOut('fast');
        $('#FormArea').fadeIn('fast');
    }, 1000); // <-- time in milliseconds
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM