document.form.submit() [英] document.form.submit()

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

问题描述

继承我的问题:


< a href =" javascript :void(document.buysell.submit())" target =" _parent"

onMouseOver =" MM_swapImage(''members'','''',''images / membersf2.gif'',1)"

onMouseOut =" MM_swapImgRestore()">< img src =" images / members.gif"

alt ="返回会员页面"名称= QUOT;成员"宽度= QUOT; 270" height =" 25"

border =" 0">< / a>


我收到错误" document.buysell"是null或不是对象,但是我的

表单名称是buysell,当使用提交按钮时,这不是

被称为提交,一切都提交正常。 ..

请帮忙,

克里斯。

Heres my problem:

<a href="javascript:void(document.buysell.submit())" target="_parent"
onMouseOver="MM_swapImage(''members'','''',''images/membersf2.gif'',1)"
onMouseOut="MM_swapImgRestore()"><img src="images/members.gif"
alt="Back to members page" name="members" width="270" height="25"
border="0"></a>

I get the error "document.buysell" is null or not an object, but my
form name is buysell and when using the submit button, which is not
called "submit", everything submits fine....
please help,
Chris.

推荐答案

克里斯于2003年12月16日写道在comp.lang.javascript
Chris wrote on 16 dec 2003 in comp.lang.javascript:
< a href =" javascript :void(document.buysell.submit())" target =" _parent"
onMouseOver =" MM_swapImage(''members'','''',''images / membersf2.gif'',1)"
onMouseOut =" MM_swapImgRestore ()">< img src =" images / members.gif"
alt ="返回会员页面"名称= QUOT;成员"宽度= QUOT; 270" height =" 25"
border =" 0">< / a>

我收到错误document.buysell是null或不是对象,但我的
表单名称是buysell,当使用提交按钮时,这不是名为提交,一切都提交正常....


document.forms.buysell.submit()


我会将目标声明放在< form>

并使用没有< a>根本:


< img

onclick =" document.forms.buysell.submit()"

onMouseOver =" ..."

onMouseOut =" ..."

src =" images / members.gif"

alt ="返回会员页面"

name =" members" id =" members"

width =" 270" height =" 25"
<a href="javascript:void(document.buysell.submit())" target="_parent"
onMouseOver="MM_swapImage(''members'','''',''images/membersf2.gif'',1)"
onMouseOut="MM_swapImgRestore()"><img src="images/members.gif"
alt="Back to members page" name="members" width="270" height="25"
border="0"></a>

I get the error "document.buysell" is null or not an object, but my
form name is buysell and when using the submit button, which is not
called "submit", everything submits fine....
document.forms.buysell.submit()

I would put the target declaration in the <form >
and use no <a> at all:

<img
onclick="document.forms.buysell.submit()"
onMouseOver="..."
onMouseOut="..."
src="images/members.gif"
alt="Back to members page"
name="members" id="members"
width="270" height="25"




-

Evertjan。

荷兰。

(请将我的电子邮件地址中的x'更改为点数)



--
Evertjan.
The Netherlands.
(Please change the x''es to dots in my emailaddress)


文章< c2 ************* *************@posting.google.com>,
ch **************** @ hotmail.com 启发我们...
In article <c2**************************@posting.google.com >,
ch****************@hotmail.com enlightened us with...
继承人我的问题:

< a href =" javascript :void(document.buysell.submit())"


首先,虚空只是 - 无效。没有参数。

如果你必须使用它,因为你必须支持旧的浏览器,请使用

< a href =" javascript :document .forms [" buysell"]。submit();


如果您只支持较新的浏览器,请以正确的方式执行此操作。

< a href ="#" onClick =" document.forms [''buysell'']。submit; return false;"


请记住约5%的美国用户(最后我读过一些IT

网站,无论如何)没有JS启用的浏览器。对他们来说,这根本不会提交任何形式的b $ b。如果这是针对互联网网站的话,对于没有JS的人,你应该真的有一些东西。

target =" _parent"
onMouseOver =" ; MM_swapImage(''members'','''',''images / membersf2.gif'',1)"
onMouseOut =" MM_swapImgRestore()">< img src =" images / members.gif"
alt ="返回会员页面"名称= QUOT;成员"宽度= QUOT; 270" height =" 25"
border =" 0">< / a>

我收到错误document.buysell是null或不是一个对象,但我的
表单名称是buysell,当使用提交按钮,而不是名为提交时,一切都提交正常....
Heres my problem:

<a href="javascript:void(document.buysell.submit())"
First of all, void is just that - void. No params.
If you MUST use this because you have to support old browsers, use
<a href="javascript:document.forms["buysell"].submit();

If you support only newer browsers, do this the right way.
<a href="#" onClick="document.forms[''buysell''].submit;return false;"

Keep in mind about 5% of US users in general (last I read on some IT
site, anyway) do not have JS enabled browsers. For them, this will not
submit any form at all. You should really have something in that href
for people with no JS if this is for an internet site.
target="_parent"
onMouseOver="MM_swapImage(''members'','''',''images/membersf2.gif'',1)"
onMouseOut="MM_swapImgRestore()"><img src="images/members.gif"
alt="Back to members page" name="members" width="270" height="25"
border="0"></a>

I get the error "document.buysell" is null or not an object, but my
form name is buysell and when using the submit button, which is not
called "submit", everything submits fine....



我注意到你引用了父母作为目标。该表格与此脚本在同一页面上是否相同?如果没有,您应该将其引用为

top.frames [" framename"]。document.forms [" formname"]

以确保脚本可以 ;见"它。


-

-

~kaeli~

墨菲定律#2000:如果收集了足够的数据,可以通过统计方法证明任何


http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


I notice you reference "parent" as the target. Is the form on the same
page as this script? If not, you should reference it as
top.frames["framename"].document.forms["formname"]
to be sure the script can "see" it.

--
--
~kaeli~
Murphy''s Law #2000: If enough data is collected, anything
may be proven by statistical methods.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace


Chris写道:
Chris wrote:
继承人我的问题:

< a href =" javascript :void(document.buysell.submit())" target =" _parent"
onMouseOver =" MM_swapImage(''members'','''',''images / membersf2.gif'',1)"
onMouseOut =" MM_swapImgRestore ()">< img src =" images / members.gif"
alt ="返回会员页面"名称= QUOT;成员"宽度= QUOT; 270" height =" 25"
border =" 0">< / a>

我收到错误document.buysell是null或不是对象,但我的
表单名称是buysell,当使用提交按钮时,这不是名为提交,一切都提交正常....
请帮助,
Chris。
Heres my problem:

<a href="javascript:void(document.buysell.submit())" target="_parent"
onMouseOver="MM_swapImage(''members'','''',''images/membersf2.gif'',1)"
onMouseOut="MM_swapImgRestore()"><img src="images/members.gif"
alt="Back to members page" name="members" width="270" height="25"
border="0"></a>

I get the error "document.buysell" is null or not an object, but my
form name is buysell and when using the submit button, which is not
called "submit", everything submits fine....
please help,
Chris.




如果您想要一些看似链接的东西来提交表格,我建议:b $ b推荐:


< style type =" text / css">

..submitLink {

background-color:transparent;

填充:8px;

边框:0px实心透明;

颜色:蓝色;

text-decoration:下划线;

光标:指针;

光标:手;

}

..submitLink:active {

border:0px solid transparent;

颜色:红色;

}

}

< / style>

< form>

< input type =" submit"名称= QUOT; submitBtn"值= QUOT;订单"类= QUOT; submitLink" />


< / form>


当然它在Netscape 4或Opera 6中并不漂亮,但它'无论使用何种浏览器

(假设浏览器支持表单和表单提交),
保证为您提供可用的提交按钮。

顺便说一句,Opera 7.23仍然*有这个设计的问题。使用

7.23,它现在可以满足按钮上的边界请求,但它既不支持

游标:也不支持text-decoration:指令。另外,Opera 7.23好像支持:b $ b支持:active伪类,至少部分地,它使一个勇敢的

尝试尊重border:指令,但是它没有做得对。


-

| Grant Wagner< gw ***** @ agricoreunited.com>


*客户端Javascript和Netscape 4 DOM参考可从以下位置获得:

*
http:// devedge .netscape.com / library / ... ce / frames.html


* Internet Explorer DOM参考资料:

*
http://msdn.microsoft.com/研讨会/ a ... ence_entry.asp


* Netscape 6/7 DOM参考资料于:

* http://www.mozilla.org/docs/dom/domref/

*为Netscape 7 / Mozilla升级JavaScript的提示

* http://www.mozil la.org/docs/web-deve...upgrade_2.html



If you want something that looks like a link to submit a form, I
recommend:

<style type="text/css">
..submitLink {
background-color: transparent;
padding: 8px;
border: 0px solid transparent;
color: Blue;
text-decoration: underline;
cursor: pointer;
cursor: hand;
}
..submitLink:active {
border: 0px solid transparent;
color: Red;
}
}
</style>
<form>
<input type="submit" name="submitBtn" value="Order" class="submitLink" />

</form>

Certainly it isn''t as pretty in Netscape 4 or Opera 6, but it''s
guaranteed to give you a usable submit button regardless of the browser
being used (presuming the browser supports form and form submission).

By the way, Opera 7.23 is *still* having problems with this design. With
7.23, it now honors border requests on buttons, but it honors neither the
cursor: nor the text-decoration: directives. Also, Opera 7.23 seems to
support the :active pseudo-class, at least partially, it makes a valiant
attempt to honor the border: directive, but it fails to do it correctly.

--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html


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

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