Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/403.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ASP中与document.form.submit()相关的问题_Javascript - Fatal编程技术网

Javascript ASP中与document.form.submit()相关的问题

Javascript ASP中与document.form.submit()相关的问题,javascript,Javascript,网页上有3个按钮。单击每个按钮时,将打开一个相同的弹出窗口(如window1)。现在在这个弹出窗口(window1)上有另一个按钮,它进一步打开另一个弹出窗口(比如window2)。从“window2”中选择某个值时,该值将传递到“window1”。“window1”上有一个“Find”链接,它调用javascript函数“clicked()”: 函数单击() { document.form.hid.value='FIND'; 警报(“之前”);--出现此消息框 **document.form

网页上有3个按钮。单击每个按钮时,将打开一个相同的弹出窗口(如window1)。现在在这个弹出窗口(window1)上有另一个按钮,它进一步打开另一个弹出窗口(比如window2)。从“window2”中选择某个值时,该值将传递到“window1”。“window1”上有一个“Find”链接,它调用javascript函数“clicked()”:


函数单击()
{
document.form.hid.value='FIND';
警报(“之前”);--出现此消息框
**document.form.submit();**--经过大量分析,结论是
此提交语句停止工作(与状态相同)
bar“打开https:..…File1.asp?表单=…”不可用
当“之后”消息框出现时显示
警报(“之后”);--出现此消息框
}
此完整代码在我的机器上运行正常。但在客户端运行时,此代码无法正常工作!尽管正在访问同一服务器和同一部署的应用程序。除了例如,没有特定的序列/场景。 当说按钮1单击->窗口1打开->窗口2打开->选择值->返回到窗口1->单击查找->单击确定->返回主页面。 然后对第三个按钮重复相同的场景。 (到目前为止,“查找”链接工作正常)。
现在对第二个按钮重复相同的场景,这里获得了“after”消息,但没有打印“inside Find”!!

文档对象没有
表单
属性

只有当表单上有属性
name=“form”
并且页面上只有一个表单具有该名称时,代码才起作用。这对于表单来说是个坏名字,因为DOM中的其他对象实际上具有
form
属性(即表单中的字段)


您应该为表单指定一个明确的名称,并使用
document.forms
集合来访问表单,而不是依赖于表单被添加到文档名称空间。

欢迎这样做。您可以检查Firefox脚本控制台是否有错误吗?因为这与ASP无关,您可以将实际生成的代码发布为应用程序吗浏览器中的耳朵?
<head>
<%
Dim command
command = Request.Form("hid");
Response.Write(“Value” & command);  -- The value is not printed (Reason found after 
                                                   analysis that may be because the form is not submitted 
                                                    successfully)
%>

function clicked()
{
document.form.hid.value='FIND';
alert("before");              -- This message box appears
**document.form.submit();**  -- after a lot of analysis the conclusion is that 
                                  this submit statement stops working (as on the status   
                                  bar 'Opening https:.....File1.asp?form=...' is not 
                                  displayed when 'after' message box appears
alert("after");               -- This message box appears 
}

<body.......>
<% if command = "FIND" then
Response.Write ("Inside Find"); -- This message is not printed.
  // some functonality

%>
<form ....>

<input type="hidden" name="hid" value="">

</form>
</body>