JavaScript的自动开机自检与NAME

JavaScript的自动开机自检与NAME

本文介绍了JavaScript的自动开机自检与NAME的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有我建立一个的OnBase电子表格。有表格上有三个按键,所有的提交。确实的OnBase基于用于提交表单按钮的名称不同的事情。如果按钮有一个名称 OBBtn_CrossReference 的它会打开一个交叉引用文档另一扇窗。我需要以编程'点击'那个按钮。

I have an OnBase e-Form that I'm building. There are three buttons on the form that all submit. OnBase does different things based on the name of the button used to submit the form. If the button has a name of OBBtn_CrossReference it opens another window with a cross referenced document. I need to programmatically 'click' that button.

我读过有关如何使用JavaScript提交表单的几个职位,但似乎没有实现我的目标。我只需要 POST ,并把它似乎来自一个名为按钮 OBBtn_CrossReference

I've read several posts about how to use JavaScript to submit a form, but none seem to accomplish my goal. I just need to POST and to have it appear to come from a button named OBBtn_CrossReference.

我不需要提交任何数据。该页面正在设置方式,整个页面已经是一种形式,因为我不想打破其他形式的按钮的功能,看来我必须离开这种方式。

I don't need to submit any data. The way the page is currently set up, the entire page is already a form and since I don't want to break the functionality of the other form buttons it seems I must leave it that way.

更新:
下面的建议进行了测试从的onload通话事件在标记,因为按钮的帖子页面重新加载并调用时一遍又一遍的产卵无限的子窗口。我想AP preciate只被点击如何获得按钮建议第一次加载页面,而不是回发。

UPDATE:The suggestion below was tested as a call from the onload event in the body tag and since the button posts the page reloads and the call is made over and over again spawning unlimited child windows. I would appreciate a suggestion on how to get the button to only be clicked the first time the page is loaded and not on postback.

推荐答案

我知道我是一个有点晚了这个职位,但你可以尝试利用Cookie来完成这件事:

I know I am a little late to this post, but you can try and leverage a cookie to get this done:

if (document.cookie.indexOf('xref=true', 0) < 0) {

    // Set the xRef cookie, so we do not fire it again for this form.
    document.cookie = 'xref=true';

    //alert(document.cookie);
    document.getElementById("OBBtn_CrossReference").click();
}
else {

    document.cookie = "xref=false";
    //alert(document.cookie);
}

我在10.0这个测试的厚与薄客户端和它工作得很好。

I tested this on the Thick and Thin clients in 10.0 and it worked fine.

本网站上的帖子是我自己的,不一定再present我公司的立场,策略或观点。

这篇关于JavaScript的自动开机自检与NAME的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-30 03:55