zoukankan      html  css  js  c++  java
  • 相关联文章操作

    文章相关联操作

    <div class="control-group">
            <label class="control-label">相关文章:</label>
    
            <div class="controls">
                <form:hidden id="articleDataRelation" path="articleData.relation" htmlEscape="false" maxlength="200"
                             class="input-xlarge"/>
                <ol id="articleSelectList"></ol>
                <a id="relationButton" href="javascript:" class="btn">添加相关</a>
                <script type="text/javascript">
                    var articleSelect = [];
                    function articleSelectAddOrDel(id, title) {
                        var isExtents = false, index = 0;
                        for (var i = 0; i < articleSelect.length; i++) {
                            if (articleSelect[i][0] == id) {
                                isExtents = true;
                                index = i;
                            }
                        }
                        if (isExtents) {
                            articleSelect.splice(index, 1);
                        } else {
                            articleSelect.push([id, title]);
                        }
                        articleSelectRefresh();
                    }
                    function articleSelectRefresh() {
                        $("#articleDataRelation").val("");
                        $("#articleSelectList").children().remove();
                        for (var i = 0; i < articleSelect.length; i++) {
                            $("#articleSelectList").append("<li>" + articleSelect[i][1] + "&nbsp;&nbsp;<a href="javascript:" onclick="articleSelectAddOrDel('" + articleSelect[i][0] + "','" + articleSelect[i][1] + "');">×</a></li>");
                            $("#articleDataRelation").val($("#articleDataRelation").val() + articleSelect[i][0] + ",");
                        }
                    }
                    $.getJSON("${ctx}/cms/article/findByIds", {ids: $("#articleDataRelation").val()}, function (data) {
                        for (var i = 0; i < data.length; i++) {
                            articleSelect.push([data[i][1], data[i][2]]);
                        }
                        articleSelectRefresh();
                    });
                    $("#relationButton").click(function () {
                        top.$.jBox.open("iframe:${ctx}/cms/article/selectList?pageSize=8", "添加相关", $(top.document).width() - 220, $(top.document).height() - 180, {
                            buttons: {"确定": true}, loaded: function (h) {
                                $(".jbox-content", top.document).css("overflow-y", "hidden");
                            }
                        });
                    });
                </script>
            </div>
        </div>
  • 相关阅读:
    集合的代数运算
    集合的代数运算
    poj1639 Picnic Planning,K度限制生成树
    C/C++学习站点资源
    Mustache 使用心得总结
    PostgreSQL服务端监听设置及client连接方法
    【线性规划与网络流24题】汽车加油行驶问题 分层图
    linux系统下信号具体解释2
    【数据结构】栈-数组的实现
    EJB究竟是什么,真的那么神奇吗??
  • 原文地址:https://www.cnblogs.com/Liang-Haishan216/p/7339408.html
Copyright © 2011-2022 走看看