lhgdialog

【文件&目录】
[lhgdialog] 文件夹 实际项目中要使用的组件文件和组件源文件
index.html 组件说明示例主页面
[_doc] api文档和其它一些文档文件夹,实际使用中不需要此文件夹
[_demo] 组件演示示例文件夹,实际使用中不需要此文件夹

【项目发布】
下载地址:http://code.google.com/p/lhgdialog/downloads/list
官方论坛:http://bbs.lhgcore.com
官方微博:http://t.qq.com/lhgcore

【开源协议】
GNU Lesser General Public License

 

实例:

 

<script type="text/javascript">
 function add(){
  var dlg = new $.dialog({winObj:window, id:'add',title:'添加详细信息',cancelBtn:false,btns:false,page:"<%=path%>/servlet/JCYManageServlet?method=addJCYInfoPage",width:730,height:530,fnok:function(){window.location.reload();}});
    dlg.ShowDialog();
 }

 var dg = frameElement.dg;
 dg.addBtn( 'cancel', '取消', dg.cancel );
 if("modify"=='<%=operater%>'){
  dg.addBtn( 'save', '修改', save );
 }else if("save"=='<%=operater%>'){
  dg.addBtn( 'save', '保存', save );
 }

  $(function(){$("#addTrainInfo").click(function(){
   uuidStr = $("#P_TUUID").val();
   //alert(uuidStr);
   var dlg = new dg.curWin.$.dialog({parent:dg,
   winObj:window,id: 'allTrainTree', 
   title: '培训信息', 
   page:'<%=path%>/servlet/JCYManageServlet?method=loadTrainInfo&org_tree_code=AIRCRAFT_MODEL_TREE&orgUuid='+"",
   width:700,
   height:400,
   cover:true,
   fnok:function(uuId,name){
    
     $("#P_TUUID").val($("#P_TUUID").val()+uuId);
     $("#tablepxb1").append(name);
   },
   dgOnLoad:function()
   {
    this.dgWin._initLoad();
   },
   selectedTrainUuids:uuidStr
   });
   dlg.ShowDialog();
  });
 });
 
 var dg = frameElement.dg;
  
  //页面加载完之后执行的操作
  
  dg.addBtn("submit","确定",function(){
   var idStr = "";
   var nameStr = "";
            $("input[name='checkbox']:checkbox").each(function(){ 
                if($(this).attr("checked")){
                    idStr += $(this).attr("id")+":";
                    nameStr += $(this).val();
                }
            })
           //alert(nameStr);
           //alert(dg.opt.fnok);
   if(dg.opt.fnok)
   {
    dg.opt.fnok(idStr,nameStr);
    dg.cancel();
   }
  });

  //判断数组中是否包含某字符
   var flag = 0;
      function getFlag(arr1, str)
      {
          for(var i = 0; i < arr1.length; i++)
          {
                  if(arr1[i] == str)
                  {
                        flag ++;
                        break;
                  }
          }   
      }
      
      $(function(){$("input[name='checkbox']:checkbox").click(function(){
       var uuidStr = dg.opt.selectedTrainUuids;
         var uuids = uuidStr.split(":");
         var strId = $(this).attr("id");
         getFlag(uuids, strId);
         if(flag>0)
         {
          alert("该项内容已经选过了!");
          $(this).attr("checked",false);
          flag = 0;
          return;
         }
        });
   });

    </script>

 

 

 

关闭之前刷新父窗口:

 <script type="text/javascript">
         
var DG = frameElement.lhgDG;
         
function closdlg() {
             DG.cancel();
         }
         
function closdlgreload() {
             DG.curWin.location.reload();
             DG.cancel();
         }
    
</script>
 
相关学习网址:

 

posted @ 2012-05-28 15:57  Brook Legend  阅读(426)  评论(0编辑  收藏  举报