(6)js ui库

(6)熟悉js ui库中的Dialog、Workbench Tab、PopupMenu等常用js类及UI组件的js API

  • Dialog
    FSR命名空间下的对话框组件.用于弹出对话框
<script type="text/javascript">

        function openCustomDialog() {
                FSR.show({
                        title : "自定义信息对话框",
                        icon : "/icons/question48.png",
                        message : "该操作有风险,您确认继续吗?",
                        buttonAlign : "center",
                        buttons : [ {
                                text : '确定',
                                width : 80,
                                click : function(event) {
                                        FSR.tips("您点击了确定!");
                                        return true;
                                }
                        }, {
                                text : '下一步',
                                width : 80,
                                buttonClose : false,
                                click : function(event) {
                                        FSR.tips("您点击了下一步!");
                                        return true;
                                }
                        }, {
                                text : '取消',
                                width : 80,
                                click : function(event) {
                                        FSR.tips("您点击了取消!");
                                        return true;
                                }
                        } ]
                });
        }

        function confirmDialog() {
                FSR.confirm("操作不可恢复,您确定要删除所选的数据行吗?", function() {
                        FSR.tips("您选择了确定");
                }, function() {
                        FSR.tips("您选择了取消");
                });
        }

        function alertDialog() {
                FSR.alert("你的操作存在风险!");
        }

        function tipsDialog() {
                FSR.tips("数据已保存成功!",function(){
                        FSR.tips("ok");
                });
        }
        
        function successDialog() {
                FSR.success("数据保存成功!");
        }

        function errorDialog() {
                FSR.error("操作失败,你无权进行此操作!");
        }

        function loadingDialog() {
                FSR.loading("数据正在载入中,请您耐心等候...");
        }

        function openBaseDialog() {
                var dialog = new FSR.Dialog("我的对话框",450);
                dialog.setBodyHtml("<div class='p20' style='font-size:20px;text-align:center'>hello world!</div>");
                var saveBtn = dialog.addButton({
                        text : '保存',
                        width : 80
                });
                
                saveBtn.setDisabled(true);
                
                dialog.addButton({
                        text : '关闭',
                        width : 80
                });
                
                dialog.open();
        }

        function openEditDialog() {
                var dialog = new FSR.Dialog("编辑对话框",600);
                dialog.setBodyUrl("edit_content.jsp");
                dialog.open();
        }
        
        function openListDialog() {
                var dialog = new FSR.Dialog("列表对话框",600,300);
                dialog.setBodyUrl("dialog_list_content.jsp");
                dialog.open();
        }
</script>
</head>
<body>

        <div class="p10">
                <f:ButtonBar styleClass="fsr-btn-bar">
                        <f:Button text="基本对话框" onclick="openBaseDialog()" />
                        <f:Button text="确认对话框" onclick="confirmDialog()" />
                        <f:Button text="警告对话框" onclick="alertDialog()" />
                        <f:Button text="信息提示框" onclick="tipsDialog()" />
                        <f:Button text="成功信息对话框" onclick="successDialog()" />
                        <f:Button text="错误信息对话框" onclick="errorDialog()" />
                        <f:Button text="加载中对话框" onclick="loadingDialog()" />
                        <f:Button text="自定义对话框" onclick="openCustomDialog()" />
                        <f:Button text="编辑对话框" onclick="openEditDialog()" />
                        <f:Button text="列表对话框" onclick="openListDialog()" />
                </f:ButtonBar>
        </div>

</body>

在这里插入图片描述

  • Workbench Tab
  • FSR命名空间下的工作空间组件
$(function() {
		if (!USER) {
			FSR.error("您尚未登录", function() {
				location.href = "login.jsp";
			});
		}

		window.WB_INST = new FSR.Workbench();
		window.WB_INST.initialize();
		window.WB_INST.openTab({
			text : '首页',
			url : "index/",
			closeable : false
		});
	});

在这里插入图片描述

  • PopupMenu
    FSR命名空间下的菜单组件
<script type="text/javascript">
        $(function() {
                var menu = new FSR.PopUpMenu({
                        items : [ {
                                text : '菜单1',
                                icon : '/icons/autologin.png',
                                onselect : function() {
                                        FSR.tips("hello world!");
                                }
                        }, {
                                text : '菜单2',
                                icon : '/icons/complete.png'
                        }, {
                                text : '菜单3'
                        }, {
                                separator : true,
                                text : '菜单4',
                                icon : '/icons/design.png',
                                children : [ {
                                        text : '菜单41'
                                }, {
                                        text : '菜单42'
                                }, {
                                        text : '菜单43'
                                }, ]
                        } ]
                });
                menu.bindContextmenu("#oDiv");

                menu.onselect = function(item) {
                        FSR.tips("您选择了菜单“" + item.text + "”");
                };
        });
</script>
<style type="text/css">
.box {
        width: 300px;
        height: 300px;
        border: 1px solid #ccc;
        text-align: center;
        vertical-align: middle;
        display: table-cell;
}
</style>
</head>
<body>
        <div class="p10">
                <div id="oDiv" class="box">右键打开菜单</div>
        </div>
</body>

在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值