zoukankan      html  css  js  c++  java
  • 转自JIM Wang:把 isv.config.xml 按钮事件移动到 entity.onload()

    大家都知道在ISV.CONFIG里可以添加按钮,然后添加按钮事件,比如下面:

    <Entities>
      
    <Entity name="account">
        
    <ToolBar ValidForCreate="0" ValidForUpdate="1">
          
    <Button Icon="/_imgs/ico_18_debug.gif" PassParams="1" WinParams="" WinMode="0" Client="Web" JavaScript="alert('Hello World!');">
          
    <Titles>
            
    <Title LCID="1033" Text="A button" />
          </Titles>
          <ToolTips>
            
    <ToolTip LCID="1033" Text="A button" />
          </ToolTips>
        </Button>
        <ToolBarSpacer />
        </ToolBar>
      </Entity>
    <!-- End Custom Entities -->
    </Entities>

    有的时候基于维护和其他一些考虑,可以将这个按钮事件放到entity的onload()事件里(比如你有大量的JavaScript代码)。但是可能你已经注意到了,这种isv.config生成的按钮 ID 是变化的,也就是说在onload()事件里,你无法通过 document.getElementById() 方法获取这个按钮,而isv.config.xml 文件本身又不支持ID设定,所以要用到不同的方法:

    for (var index in document.getElementsByTagName("LI")) 
    {
        
    if(document.getElementsByTagName("LI")[index].title == "A button")
        {
            document.getElementsByTagName(
    "LI")[index].onclick = Button_Click;
            
    break;
        }
    }

    function Button_Click()
    {
        alert(
    "Hello World!");
    }

    由于按钮是附属在节点"LI"上面,所以可以先遍历找到节点 "LI",然后确定哪个节点的Title=“A button”,就是在isv.config 里 指定的 Title。就可以实现这种功能了。

  • 相关阅读:
    eclipse ve 问题
    NHibernate配置
    JDOM/XPATH编程指南
    win2003的IIS配置的陷阱
    关于setInterval的用法
    用Visio来做工作流定义工具
    分类算法要解决的问题
    win2003 运行 aspx程序出现Temporary ASP.NET Files 访问被拒绝 的解决方法
    ado recordset的一个陷阱
    为ServerXMLHTTP对象的HTTP请求设置超时时间
  • 原文地址:https://www.cnblogs.com/yanluckly/p/1335774.html
Copyright © 2011-2022 走看看