• JQuery点击收起,点击展开以及部分非空小验证


                             <tr>
                                                <td nowrap align="right" width="18%">
                                                    解决方案:
                                                </td>
                                                <td width="35%">
                                                    <a href="#" id="btnShow">
                                                        <%--点击添加--%>
                                                        <img id="imgShow" style=" 50px; height: 50px" src="../images/add.jpg" />
                                                    </a>
                                                    <script type="text/javascript">
                                                        $("#btnShow").click(
                                                            function () {
                                                                if ($("#scheme").css("display") == "none") {
                                                                    $("#imgShow").attr("src", "../images/pack.jpg");
                                                                }
                                                                else if ($("#scheme").css("display") == "table-row") {
                                                                    $("#imgShow").attr("src", "../images/add.jpg");
                                                                }
                                                                $("#scheme").fadeToggle(1000);
                                                            }
                                                         );
                                                    </script>
                                                </td>
                                            </tr>
                                            <tr id="scheme" style="display: none">
                                                <td width="15%" nowrap align="right">
                                                    解决内容:
                                                </td>
                                                <td colspan="3">
                                                    <input runat="server" type="hidden" id="txtSContent" />
                                                    <%--<script id="Scontainer" style=" 600px; height: 200px" type="text/plain"></script>--%>
                                                    <textarea runat="server" id="Scontainer" style=" 600px; height: 200px" type="text/plain"></textarea>
                                                    <script type="text/javascript">
                                                        var ue = UE.getEditor('Scontainer');
    
                                                        function getContent() {
                                                            var editor = UE.getEditor("Scontainer").getContent(); //得到编辑器
                                                            //document.getElementById("txtSContent").value = editor;
                                                        }
                                                    </script>
                                                </td>
                                            </tr>

    非空验证:

     var name = $('#txtName').val();
                                            name = $.trim(name);
                                            if (name.length < 1) {
                                                alert("问题名称不为空");
                                            }
    
                                            var scontent = $('#txtSContent').val();
                                            scontent = $.trim(scontent);
                                            if (scontent.length < 1) {
                                                alert("解决内容不为空");
                                            }
    
                                            var qcontent = $('#txtQContent').val();
                                            qcontent = $.trim(qcontent);
                                            if (qcontent.length < 1) {
                                                alert("问题内容不为空");
                                            }
  • 相关阅读:
    ubuntu 11.10(32位系统)下编译android源码
    12 个基于 Rails 框架开发的 CMS 系统
    36 个 CSS 框架推荐
    再来 10 个新鲜的 HTML5 教程
    汇编程序开发环境搭配(转)
    推荐:介绍一个UndoFramework
    细数 Windows 平台上的 NoSQL 数据库
    使用ShareKit一键分享到Facebook,Twitter等平台
    25个jQuery的编程小抄
    10款iOS高效开发必备的ObjectiveC类库
  • 原文地址:https://www.cnblogs.com/llcdbk/p/4322888.html
Copyright © 2020-2023  润新知