怎样用js编写点击提交按钮出现一个提示框

xiaoxin8393 2010-01-22 04:19:02
这个真是难懂
...全文
2666 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
crazylaa 2010-01-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 xlxyeyu 的回复:]
function check() {
  if(...) {
      return true;
  } else {
      alert("验证失败!");
      return false;
  }
}

<input type="submit" onclick="return check();"/>

[/Quote]
基本这样
zl3450341 2010-01-22
  • 打赏
  • 举报
回复
onclick="return window.confirm('是否提交!')"
xlxyeyu 2010-01-22
  • 打赏
  • 举报
回复
[Quote=引用 5 楼 xiaoxin8393 的回复:]
我就会用C#.NET 写

[/Quote]
[img=https://forum.csdn.net/PointForum/ui/scripts/csdn/Plugin/003/monkey/0.gif][/img
xiaoxin8393 2010-01-22
  • 打赏
  • 举报
回复
我就会用C#.NET 写
luffyke 2010-01-22
  • 打赏
  • 举报
回复
<html>
<head>
<script type="text/javascript">
function show(){
if(confirm("确定?")){
alert("sure");
}
else{
alert("not sure")
}
}
</script>
</head>
<body>
<input type="button" value="提交" onclick="show();"/>
</body>
yangxiao_jiang 2010-01-22
  • 打赏
  • 举报
回复
js函数(放到onclick事件里)
if(confirm("确定要提交吗?")){
document.form.summit();
}
xlxyeyu 2010-01-22
  • 打赏
  • 举报
回复
function check() {
if(...) {
return true;
} else {
alert("验证失败!");
return false;
}
}

<input type="submit" onclick="return check();"/>
sotom 2010-01-22
  • 打赏
  • 举报
回复
<form onSubmit= "return ret()">

<input type="submit">

</form>

function ret(){
if(confirm("您确认提交吗?")) {
return true;
};
return false;
}



看懂没?

50,523

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧