EasyUI Dialog弹出框+JS执行字符串

【转载请注明出处:http://blog.csdn.net/leytton/article/details/38614173

虽然写得不是很全面,但这是项目中经常用到的

Dialog弹出框

Div标签

<div id="dialogDemo" class="easyui-dialog" title="Dialog标题" style="width:400px;top:120px;" data-options="iconCls:'icon-save',closed:'true',modal:true" >  
Dialog内容<br/>
iconCls:图标<br/>
closed:默认关闭<br/>
modal:模态框
</div>

JS代码

<script type="text/javascript">
	function openDialog(){
	    $('#dialogDemo').dialog('open');
	}
</script>

更多Dialog选项

摘自http://blog.csdn.net/limlimlim/article/details/10297879

<script type="text/javascript">
        $(function () {
            $("#myDialog").dialog({
                modal: true,
                collapsible: true,             //设置可折叠
                toolbar: [{                          //设置工具栏数组
                    text: '添加',
                    iconCls: 'icon-add',
                    handler: function () {
                        $.messager.show({ showType: "fade", msg: "添加数据", title: "提示", timeout: 1000 });
                    }
                }, {
                    text: '保存',
                    iconCls: 'icon-save',
                    handler: function () {
                        $.messager.show({ showType: "fade", msg: "保存数据", title: "提示", timeout: 1000 });
                    }
                }],
                buttons: [{                    //设置下方按钮数组
                    text: '提交',
                    iconCls: 'icon-ok',
                    handler: function () {
                        $.messager.show({ showType: "fade", msg: "提交数据", title: "提示", timeout: 1000 });
                    }
                }, {
                    text: '取消',
                    iconCls: 'icon-cancel',
                    handler: function () {
                    }
                }]
            });
        });
    </script>

JS执行字符串

var str="alert('Hello~')";			
eval(str);


posted @ 2014-08-16 16:16  Leytton  阅读(599)  评论(0编辑  收藏  举报