通过单击链接将表单发布到对话框窗口中 [英] Post form into dialog window by clicking a link

查看:89
本文介绍了通过单击链接将表单发布到对话框窗口中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力使这段代码起作用.

I'm trying to make this piece of code work.

<form name="myform" onsubmit="alert('1');"> </form>
<a href="javascript: void(0);" onclick="document.myform.submit();">ok</a>

但是,当我单击确定"时,什么也没有发生.我在哪里弄错了?

However nothing happens when I click "ok". Where have I mistaken?

推荐答案

如果以编程方式调用submit方法,则浏览器不会触发onsubmit事件.因此,如果表单正在使用表单验证程序脚本,请同时调用onsubmit方法以触发验证.

The browser does not trigger the onsubmit event if you call the submit method programmatically. Therefore, if the form is using the form validator script, call the onsubmit method also to trigger the validation.

http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml (还有一个示例)

因此,您的表单已发布,但未触发onsumbit.

So, your form is posted but onsumbit is not triggered.

这篇关于通过单击链接将表单发布到对话框窗口中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆