• easyui----combo组件


    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <base href="<%=basePath%>">
    
    <title>My JSP '003.jsp' starting page</title>
    
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <script type="text/javascript"
        src="js/jquery-easyui-1.2.6/jquery-1.7.2.min.js"></script>
    <link rel="stylesheet" type="text/css"
        href="js/jquery-easyui-1.2.6/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css"
        href="js/jquery-easyui-1.2.6/themes/icon.css" />
    <script type="text/javascript"
        src="js/jquery-easyui-1.2.6/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="js/city.js"></script>
    <script type="text/javascript"
        src="js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js"></script>
        <script>
            $(function(){
                $('#cc').combo({
                    required:true,
                    editable:false
                });
                $('#sp').appendTo($('#cc').combo('panel'));
                $('#sp input').click(function(){
                    var v = $(this).val();
                    var s = $(this).next('span').text();
                    
                    $('#cc').combo('setValue', v).combo('setText', s).combo('hidePanel');
                    console.log($('#cc').combo('setValue', v).combo('setText', s));
                });
            });
        </script>
    </head>
    <body>
        <h2>Custom Combo</h2>
        <div class="demo-info" style="margin-bottom:10px">
            <div class="demo-tip icon-tip"></div>
            <div>Click the right arrow button to show drop down panel that can be filled with any content.</div>
        </div>
        
        <select id="cc"></select>
        <div id="sp">
            <div style="color:#99BBE8;background:#fafafa;padding:5px;">Select a language</div>
            <input type="radio" name="lang" value="01"><span>Java</span><br/>
            <input type="radio" name="lang" value="02"><span>C#</span><br/>
            <input type="radio" name="lang" value="03"><span>Ruby</span><br/>
            <input type="radio" name="lang" value="04"><span>Basic</span><br/>
            <input type="radio" name="lang" value="05"><span>Fortran</span>
        </div>
    </body>
    </html>
    $(this).next('span'):div的同级下一个元素就是span,注意<input> 标签没有结束标签。
    .appendTo 和append是相反的
     点击图片,面板框中显示图片的text
    <%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
      <head>
        <base href="<%=basePath%>">
        
        <title>My JSP '009_combo.jsp' starting page</title>
        
        <meta http-equiv="pragma" content="no-cache">
        <meta http-equiv="cache-control" content="no-cache">
        <meta http-equiv="expires" content="0">    
        <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
        <meta http-equiv="description" content="This is my page">
        <link rel="stylesheet" type="text/css" href="css/common.css" />
        <script type="text/javascript" src="js/jquery-easyui-1.2.6/jquery-1.7.2.min.js"></script>
        <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.2.6/themes/default/easyui.css" />
        <link rel="stylesheet" type="text/css" href="js/jquery-easyui-1.2.6/themes/icon.css" />
        <script type="text/javascript" src="js/jquery-easyui-1.2.6/jquery.easyui.min.js"></script>
        <script type="text/javascript" src="js/jquery-easyui-1.2.6/locale/easyui-lang-zh_CN.js"></script>
        <script>
            $(function(){
                $('#cc').combo({
                    required:true,
                    editable:false ,
                    255 ,
                    panelHeight:300 
                });
                $('#sp').appendTo($('#cc').combo('panel'));
                $('#sp img').click(function(){
                    var v = $(this).attr('value');
                    var s = $(this).attr('text');
                    $('#cc').combo('setValue', v).combo('setText', s).combo('hidePanel');
                });
            });
        </script>
      </head>
      
      <body>
        <select id="cc"></select>
        <div id="sp">
            <div style="color:#99BBE8;background:#fafafa;padding:5px;">Select a language</div>
            <div>
                <img src="images/001.jpg" value="001.jpg" text="图片1" ></img> <!-- value是自定义属性,img没有value属性 -->
            </div>
            <div>
                <img src="images/002.jpg" value="002.jpg" text="图片2" ></img>
            </div>
            <div>
                <img src="images/003.jpg" value="003.jpg" text="图片3" ></img>
            </div>
            <div>
                <img src="images/004.jpg" value="004.jpg" text="图片4" ></img>
            </div>
            <div>
                <img src="images/005.jpg" value="005.jpg" text="图片5" ></img>
            </div>                                
        </div>
      </body>
    </html>
  • 相关阅读:
    我的python之路5
    我的python之路4
    我的python之路3
    我的python之路2
    我的python之路1
    AJAX 表单提交 文件上传
    PBKDF2WithHmacSHA1算法
    Ant 随想
    maven 启蒙
    HELLO WORLD
  • 原文地址:https://www.cnblogs.com/fpcbk/p/9880555.html
Copyright © 2020-2023  润新知