function   CTRL5_5::OnClick(eventObj)  
  {  
  //   Write   your   code   here  
  var   objNode   =   XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2");  
  var   objInsertNode   =   objNode.cloneNode(true);  
  var   objCurUserNode   =   XDocument.DOM.selectSingleNode("/my:myFields/my:field4");  
  objInsertNode.selectSingleNode("/my:field3").text   =   objCurUserNode.text;  
  //   Insert   new   element  
  XDocument.DOM.selectSingleNode("/my:myFields/my:group1").appendChild(objInsertNode);  
  }  
   
  //=======  
  //   The   following   function   handler   is   created   by   Microsoft   Office   InfoPath.  
  //   Do   not   modify   the   name   of   the   function,   or   the   name   and   number   of   arguments.  
  //   This   function   is   associated   with   the   following   field   or   group   (XPath):   /my:myFields/my:group1/my:group2/my:field2  
  //   Note:   Information   in   this   comment   is   not   updated   after   the   function   handler   is   created.  
  //=======  
  function   XDocument::OnLoad(eventObj)  
  {  
  //   Get   current   user.  
  var   objCurUserNode   =   XDocument.DOM.selectSingleNode("/my:myFields/my:field4");  
  var   objNetwork   =   new   ActiveXObject("WScript.network");  
  objCurUserNode.text   =   objNetwork.UserDomain   +   "\\"   +   objNetwork.UserName;  
   
  var   objNode   =   XDocument.DOM.selectSingleNode("/my:myFields/my:group1/my:group2/my:field3");  
  if(objNode.text   ==   "")  
  {  
  objNode.text   =   objCurUserNode.text;  
  }  
  }  
   
  利用重复表,还需要结合InfoPath自己本身的选项定义显示条件,就可以了。
posted on 2008-06-01 13:11  晃晃悠悠  阅读(304)  评论(0)    收藏  举报