Javascript submit()函数 [英] Javascript submit() function

查看:132
本文介绍了Javascript submit()函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以..我有一个提交到用C-sharp制作的ASP.net网站的表单。

ASP网站不是我的,我没有服务器端代码。 />

当我通过按下提交按钮从我的表单提交时,我得到的结果与我使用javascript提交时的结果不同:form1.submit();。

我认为javascript提交正常工作,因为我想要服务器处理__EVENTTARGET帖子的
。当我单击

提交按钮时,它不会处理__EVENTTARGET字段。但是,

它是否应该以相同的方式工作,无论我点击一个按钮还是

javascript提交,对吧?为什么会有区别?我使用firefox

查看哪些字段被发布到服务器,POSTFields,

引用等等都是相同的。


哦,顺便说一下,当我使用libcurl发布相同的字段时,它也没有
处理__EVENTTARGET,就像我点击了提交按钮一样。

So.. I have a form that submits to an ASP.net site made in C-sharp.
The ASP site is not mine, i do not have the server side code.

When I submit from my form by pressing the Submit button, I get
different results than when I use a javascript submit: form1.submit();.
I think the javascript submit is working as it should, since I want
the server to process an __EVENTTARGET posting. When I click the
submit button, it does not process the __EVENTTARGET field. However,
it should really work the same way whether i click a button or whether
javascript submits, right? Why is there a difference? I used firefox
to see what fields were being posted to the server, and the POSTFields,
referrer, etc. all are identical.

Oh, btw, when I use libcurl to post the same fields, it does not
process the __EVENTTARGET either, as if I had clicked the submit button.

推荐答案

ljlolel在2006年5月17日下午7:10发表以下内容:
ljlolel said the following on 5/17/2006 7:10 PM:
所以..我有一个提交的表单到一个用C-sharp制作的ASP.net网站。
ASP网站不是我的,我没有服务器端代码。


与客户端Javascript无关。

当我通过按下提交按钮从我的表单提交时,我得到的结果与我使用时不同一个javascript提交:form1.submit();.


然后表单可能有一个onsubmit事件处理程序,它改变了表格的'

内容。

我认为是javascript提交正在按预期工作,因为我希望服务器处理__EVENTTARGET发布。当我单击
提交按钮时,它不会处理__EVENTTARGET字段。但是,无论是单击按钮还是javascript提交,它应该以同样的方式工作,对吧?


No.

为什么会有区别?


因为它们是使用不同的方法提交的。

我使用firefox查看哪些字段被发布到服务器,以及POSTFields,
引用者等都是一样的。

哦,顺便说一下,当我使用libcurl发布相同的字段时,它也不会处理__EVENTTARGET,就像我点击了提交按钮一样。
So.. I have a form that submits to an ASP.net site made in C-sharp.
The ASP site is not mine, i do not have the server side code.
Irrelevant to client side Javascript.
When I submit from my form by pressing the Submit button, I get
different results than when I use a javascript submit: form1.submit();.
Then the form may have an onsubmit event handler that changes the form''s
contents.
I think the javascript submit is working as it should, since I want
the server to process an __EVENTTARGET posting. When I click the
submit button, it does not process the __EVENTTARGET field. However,
it should really work the same way whether i click a button or whether
javascript submits, right?
No.
Why is there a difference?
Because they are submitted using different methods.
I used firefox to see what fields were being posted to the server, and the POSTFields,
referrer, etc. all are identical.

Oh, btw, when I use libcurl to post the same fields, it does not
process the __EVENTTARGET either, as if I had clicked the submit button.




不确定libcurl是什么。

-

Randy

comp.lang.javascript常见问题 - http://jibbering.com/faq &新闻组每周

Javascript最佳实践 - http://www.JavascriptToolbox .com / bestpractices /



Not sure what libcurl is.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


ljlolel写道:
ljlolel wrote:
所以..我有一个提交到ASP.net网站的表单用C-sharp制作。 ASP站点不是我的,我没有服务器
侧码。

当我按下提交按钮从表单提交时,
我得到的结果与我使用javascript提交:
form1.submit();.我认为javascript提交正在工作,因为我希望服务器处理__EVENTTARGET
帖子。当我单击提交按钮时,它不会处理__EVENTTARGET字段。但是,无论是单击按钮还是javascript
提交,它都应该以相同的方式工作,对吧?


当使用提交按钮提交表单时,将使用

提交按钮的名称/值对与请求一起发送。如果您使用表单中的 - submit -

方法,则无需提交按钮即可成为成功,并且不会发送

名称/值对。但是,有能力的服务器端脚本作者

将确定一些默认操作来处理用户

提交表单而不使用提交按钮的情况(浏览器提供不同的
这样做的机制,包括键盘快捷键。

为什么会有区别?我使用firefox
来查看哪些字段被发布到服务器,
和POSTFields,引用者等都是相同的。
So.. I have a form that submits to an ASP.net site made in
C-sharp. The ASP site is not mine, i do not have the server
side code.

When I submit from my form by pressing the Submit button,
I get different results than when I use a javascript submit:
form1.submit();. I think the javascript submit is working as
it should, since I want the server to process an __EVENTTARGET
posting. When I click the submit button, it does not process
the __EVENTTARGET field. However, it should really work the
same way whether i click a button or whether javascript
submits, right?
When a form is submitted using a submit button a name/value pair for the
submit button used is sent with the request. If you use the - submit -
method of the form no submit button qualifies as ''successful'' and no
name/value pair is sent. However, competent server-side script authors
will determine some default action to handle circumstances where the user
submits a form without using a submit button (browsers provide varied
mechanisms for doing so, including keyboard shortcuts).
Why is there a difference? I used firefox
to see what fields were being posted to the server,
and the POSTFields, referrer, etc. all are identical.



< snip>

是吗?


无论如何,如果这不是跨浏览器你可以

试图打电话 - 点击 - 相关提交按钮的方法

提交表格(不会是跨浏览器,因为不是所有的浏览器

实施a - click - 方法对他们的提交按钮)。


Richard。


<snip>
Are they?

In any event, if this is not intended to be cross-browser you could
attempt to call the - click - method of the pertinent submit button to
submit the form (that would not be cross-browser because not all browsers
implement a - click - method on their submit buttons).

Richard.


没有onsubmit事件处理程序。为了简化一切,我写了一个

10行表格提交给服务器。当我点击提交按钮时,

它没有注册__EVENTTARGET。当我在javascript中取消注释submit()

函数时,它会注册此输入并返回

相应的结果。


我知道这听起来很奇怪,如果我自己没有多次完成它,我就不会相信它。我不明白怎么会有一个

的区别。 Firefox列出了所有发布的字段,无论我提交哪种方式,它们都是相同的。相同的输入应该产生相同的输出,但由于某种原因,出现了非常错误。

There is no onsubmit event handler. To simplify everything, I wrote a
10-line form to submit to the server. When I click the submit button,
it doesn''t register __EVENTTARGET. When i uncomment the submit()
function in the javascript, it does register this input and returns the
appropriate results.

I know this sounds really weird, and I wouldn''t believe it if I hadn''t
done it several times myself. I dont understand how there can be a
difference. Firefox lists all of the fields posted, and they are
identical whichever way I submit. The same inputs should yield the
same outputs, but for some reason something is very wrong.


这篇关于Javascript submit()函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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