jquery - 提交表单后如何显示 Div 并隐藏表单?我试过 jquery 但它不起作用。帮我?

标签 jquery html css forms submit

提交表单后如何显示 Div 和隐藏表单?香港专业教育学院试过 jquery 但它不工作。帮我?这是代码:

website body {
background-color: black; color: green; }

#theirname {
  color:red;
  font-size: 6.0em;
  margin:auto;
  text-align:center;
  display:none;
}

#hellos {
  color:yellow;
  font-size:6.5em;
  margin-top:auto;
  text-align:left;
  display:none;
}
#thanks {
  color:yellow;
  font-size:4.3em;
  margin-right:20px;
  text-align:right;
  display:none;
}

#hello { 
  border-style:groove; 
  border-color: yellow; 
  margin:auto;
  text-align:center;
  width:300px;
}

marquee {
  color:yellow;
  font-size:30px;
}
form {
  text-align:center;
  margin:auto;
  margin-top:120px;
}
</style>
<script>
function handler() {
  var div = document.getElementById('theirname');

  var form = document.getElementById('fore');

     div.innerHTML = document.getElementById('textbox').value;
     return false;
}

$(document).ready(function(){
  $("#Fore").submit(function(e){
    $("#fore").hide(slow);
  $("#hellos").show(3000);
  $("#theirname").show(3030);
  $("#thanks").show(4000);
  });
});

</script>
</head>

<body>
<div id="hello">Welcome to here :D</div>

<marquee behavior="scroll" scroll="left" bgcolor="red" onClick="">ill update this soon...</marquee>

<div id="hellos">Hello,</div>
<div id="theirname"></div>
<div id="thanks">thank you for coming!</div>

<form id="Fore" action="submit" method="post" onSubmit="return handler();">
Your name: <input id="textbox" type="text" name="fname" size="20" />
<input type="submit" value="post" />
</form>


</body>
</html>

这是让你明白我的意思。 jfiddle

最佳答案

您的 javascript 有错误:

改变

$("#fore").hide(slow);

$("#Fore").hide('slow'); //  Your id is Fore and not fore

关于jquery - 提交表单后如何显示 Div 并隐藏表单?我试过 jquery 但它不起作用。帮我?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22049493/

相关文章:

html - 除了在 IE 中,链接不显示

javascript - 在 js 中将三个月添加到当前月份

jquery - Laravel Elixir 与 JQuery 和 JQuery UI

javascript - Jquery 删除属性在 IE 中不起作用

jquery - 如何在 asp :Image control? 上创建动画

javascript - 带有组合框的第二列

javascript - 使用AJAX访问不带扩展名的文件

javascript - 使用 jquery 更改跨度的可见性

jquery - 为什么在 IE11 上有奇怪的行为?

html - 如何在悬停子元素时更改父元素的颜色