后台添加代码的方式模态框的方法
Posted 美好的明天
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了后台添加代码的方式模态框的方法相关的知识,希望对你有一定的参考价值。
以添加含有帮助的方式为例:
1,在某DIV后面增加代码:
$("#ListBoxControl1_1772158006").after(function() { return "<div id=‘firstmodal‘ class=‘modal container fade‘ role=‘dialog‘ tabindex=‘-1‘ style=‘display: none;‘><div class=‘modal-header‘><button type=‘button‘ class=‘close‘ data-dismiss=‘modal‘ aria-hidden=‘true‘>×</button><h4 class=‘modal-title‘>第一层模态窗口</h4></div><div class=‘modal-body‘><div id=‘GroupControl4_1811834094-body‘><div data-visible=‘true‘><a id=‘LinkLabel1_1674513499‘ name=‘‘ href=‘‘ data-visible=‘true‘ class=‘btn btn-info‘><span>修改</span></a></div><div class=‘form-group‘><label for=‘XTextBox3_2100682917‘>批号</label><div class=‘input-icon-group‘><input id=‘XTextBox3_2100682917‘ name=‘XTextBox3_2100682917‘ placeholder=‘‘ data-clearbtn=‘true‘ type=‘text‘ data-visible=‘true‘ data-bind=‘datasource:{dataSourceName:‘Instance_DataModel14_Card‘, value:‘DHDFL.BATCHID‘}‘ data-bv-notempty=‘false‘ class=‘form-control‘> <span data-role=‘clearBtn‘ class=‘iconjs iconjs-clear input-icon input-icon-clear‘> </span></div></div><div class=‘form-group‘><label for=‘XCalculator1_2100682917‘>数量</label><div class=‘input-icon-group‘><input type=‘hidden‘ value=‘2‘><input id=‘XCalculator1_2100682917‘ name=‘XCalculator1_2100682917‘ placeholder=‘‘ data-clearbtn=‘true‘ type=‘number‘ data-visible=‘true‘ data-bind=‘datasource:{dataSourceName:‘Instance_DataModel14_Card‘, numberbox:‘DHDFL.IMQUANTITY‘}‘ data-bv-notempty=‘false‘ class=‘form-control‘ data-bv-accuracy=‘true‘ data-bv-accuracy-num=‘8‘ data-bv-accuracy-message=‘‘ data-bv-field=‘XCalculator1_2100682917‘> <span data-role=‘clearBtn‘ class=‘iconjs iconjs-clear input-icon input-icon-clear‘> </span></div><small class=‘help-block‘ data-bv-validator=‘accuracy‘ data-bv-for=‘XCalculator1_2100682917‘ data-bv-result=‘NOT_VALIDATED‘ style=‘display: none;‘>请输入精度内数字</small></div><div class=‘form-group‘><label for=‘XSmartDictLookup2_723727198‘>货位</label><div class=‘input-group‘><div class=‘input-icon-group‘><input id=‘XSmartDictLookup2_723727198_value‘ name=‘XSmartDictLookup2_723727198_value‘ type=‘hidden‘ class=‘excluded‘><input type=‘text‘ id=‘XSmartDictLookup2_723727198‘ name=‘XSmartDictLookup2_723727198‘ placeholder=‘‘ data-role=‘lookup‘ data-clearbtn=‘true‘ data-showfavor=‘false‘ data-multiselect=‘true‘ data-separator=‘;‘ data-istree=‘false‘ data-visible=‘true‘ data-bind=‘datasource:{dataSourceName:‘Instance_DataModel14_Card‘, value:‘DHDFL.LOCATIONID_LOCATIONNAME‘}‘ data-bv-notempty=‘false‘ data-helpid=‘48df741a-3e3f-4e9a-b25a-64b880851ec0‘ data-valuefield=‘LOCATIONID‘ data-textfield=‘LOCATIONNAME‘ data-businessobject=‘‘ data-businessoperation=‘‘ data-permissionfield=‘‘ data-refelementid=‘‘ data-mapfields=‘{‘LOCATIONID_LOCATIONCODE‘: ‘LOCATIONCODE‘,‘LOCATIONID‘: ‘LOCATIONID‘}‘ class=‘form-control‘ readonly=‘‘> <span data-role=‘clearBtn‘ class=‘iconjs iconjs-clear input-icon input-icon-clear‘> </span></div><span class=‘input-group-btn‘><button class=‘btn btn-info search‘ type=‘button‘><i class=‘iconjs iconjs-lookup‘> </i></button></span></div></div></div><div class=‘modal-footer‘ style=‘text-align: center;‘><button type=‘button‘ data-dismiss=‘modal‘ class=‘btn btn-default‘>关闭</button></div></div>" });
2,增加弹出模态框方法:
$("#ToolStripButton3_1872779387").on("click",function() { $("#firstmodal").modal(); $("#firstmodal").simpleEnhance();//帮助初始化 });
3,总代码
$("#ListBoxControl1_1772158006").after(function() { return "<div id=‘firstmodal‘ class=‘modal container fade‘ role=‘dialog‘ tabindex=‘-1‘ style=‘display: none;‘><div class=‘modal-header‘><button type=‘button‘ class=‘close‘ data-dismiss=‘modal‘ aria-hidden=‘true‘>×</button><h4 class=‘modal-title‘>第一层模态窗口</h4></div><div class=‘modal-body‘><div id=‘GroupControl4_1811834094-body‘><div data-visible=‘true‘><a id=‘LinkLabel1_1674513499‘ name=‘‘ href=‘‘ data-visible=‘true‘ class=‘btn btn-info‘><span>修改</span></a></div><div class=‘form-group‘><label for=‘XTextBox3_2100682917‘>批号</label><div class=‘input-icon-group‘><input id=‘XTextBox3_2100682917‘ name=‘XTextBox3_2100682917‘ placeholder=‘‘ data-clearbtn=‘true‘ type=‘text‘ data-visible=‘true‘ data-bind=‘datasource:{dataSourceName:‘Instance_DataModel14_Card‘, value:‘DHDFL.BATCHID‘}‘ data-bv-notempty=‘false‘ class=‘form-control‘> <span data-role=‘clearBtn‘ class=‘iconjs iconjs-clear input-icon input-icon-clear‘> </span></div></div><div class=‘form-group‘><label for=‘XCalculator1_2100682917‘>数量</label><div class=‘input-icon-group‘><input type=‘hidden‘ value=‘2‘><input id=‘XCalculator1_2100682917‘ name=‘XCalculator1_2100682917‘ placeholder=‘‘ data-clearbtn=‘true‘ type=‘number‘ data-visible=‘true‘ data-bind=‘datasource:{dataSourceName:‘Instance_DataModel14_Card‘, numberbox:‘DHDFL.IMQUANTITY‘}‘ data-bv-notempty=‘false‘ class=‘form-control‘ data-bv-accuracy=‘true‘ data-bv-accuracy-num=‘8‘ data-bv-accuracy-message=‘‘ data-bv-field=‘XCalculator1_2100682917‘> <span data-role=‘clearBtn‘ class=‘iconjs iconjs-clear input-icon input-icon-clear‘> </span></div><small class=‘help-block‘ data-bv-validator=‘accuracy‘ data-bv-for=‘XCalculator1_2100682917‘ data-bv-result=‘NOT_VALIDATED‘ style=‘display: none;‘>请输入精度内数字</small></div><div class=‘form-group‘><label for=‘XSmartDictLookup2_723727198‘>货位</label><div class=‘input-group‘><div class=‘input-icon-group‘><input id=‘XSmartDictLookup2_723727198_value‘ name=‘XSmartDictLookup2_723727198_value‘ type=‘hidden‘ class=‘excluded‘><input type=‘text‘ id=‘XSmartDictLookup2_723727198‘ name=‘XSmartDictLookup2_723727198‘ placeholder=‘‘ data-role=‘lookup‘ data-clearbtn=‘true‘ data-showfavor=‘false‘ data-multiselect=‘true‘ data-separator=‘;‘ data-istree=‘false‘ data-visible=‘true‘ data-bind=‘datasource:{dataSourceName:‘Instance_DataModel14_Card‘, value:‘DHDFL.LOCATIONID_LOCATIONNAME‘}‘ data-bv-notempty=‘false‘ data-helpid=‘48df741a-3e3f-4e9a-b25a-64b880851ec0‘ data-valuefield=‘LOCATIONID‘ data-textfield=‘LOCATIONNAME‘ data-businessobject=‘‘ data-businessoperation=‘‘ data-permissionfield=‘‘ data-refelementid=‘‘ data-mapfields=‘{‘LOCATIONID_LOCATIONCODE‘: ‘LOCATIONCODE‘,‘LOCATIONID‘: ‘LOCATIONID‘}‘ class=‘form-control‘ readonly=‘‘> <span data-role=‘clearBtn‘ class=‘iconjs iconjs-clear input-icon input-icon-clear‘> </span></div><span class=‘input-group-btn‘><button class=‘btn btn-info search‘ type=‘button‘><i class=‘iconjs iconjs-lookup‘> </i></button></span></div></div></div><div class=‘modal-footer‘ style=‘text-align: center;‘><button type=‘button‘ data-dismiss=‘modal‘ class=‘btn btn-default‘>关闭</button></div></div>" }); $("#ToolStripButton3_1872779387").on("click",function() { $("#firstmodal").modal(); $("#firstmodal").simpleEnhance(); });
以上是关于后台添加代码的方式模态框的方法的主要内容,如果未能解决你的问题,请参考以下文章