入戏

入戏

85飞吻 2016-10-21 加入 来自徐州

(这个人懒得留下签名)

入戏 最近的提问

入戏 最近的回答

  • 2017-9-19 22:8:34折腾几个小时才发现分页改版了。。中回答:

    @极致 因为不知道哪里出错了,只好一点点重写验证。[泪]
  • 2016-11-25 21:43:11部分样式未知问题中回答:

    CSS/JS版本导致select显示不出来或是显示不同
  • 2016-10-30 23:17:5部分样式未知问题中回答:

    用了啊
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" type="text/css" href="css/layui.css"/>

    <script src="js/layui.js" type="text/javascript" charset="utf-8"></script>

    <script type="text/javascript">$(function() {
    $("#xxnr").keyup(function() {
    var len = $(this).val().length;
    if(len > 2047) {
    $(this).val($(this).val().substring(0, 2048));
    }
    var num = 2048 - len;
    $("#word").text(num);
    });
    });</script>
    <script type="text/javascript">document.oncontextmenu = function() {
    return false;
    }</script>
    </head>
    <body style="padding: 20px;">

    <br />

    <form class="layui-form" action="">
    <div class="layui-form-item">
    <label class="layui-form-label">问题大概</label>
    <div class="layui-input-block">
    <input type="text" name="title" lay-verify="title" autocomplete="off" placeholder="5-50个字符!" class="layui-input">
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">问题类别</label>
    <div class="layui-input-block">
    <select name="interest" lay-filter="aihao">
    <option value=""></option>
    <option value="0">生活相关</option>
    <option value="1" selected="">学习相关</option>
    <option value="2">学校相关</option>
    <option value="3">游戏相关</option>
    <option value="4">其他</option>
    </select>
    </div>
    </div>



    <div class="layui-form-item">
    <label class="layui-form-label">悬赏赏金</label>
    <div class="layui-input-block">
    <select name="interest" lay-filter="aihao">
    <option value=""></option>
    <option value="10" selected="">10金币</option>
    <option value="50">50金币(略表敬意)</option>
    <option value="80">80金币</option>
    <option value="100">100金币</option>
    <option value="500">500金币(问题置顶,全站提示)</option>
    </select>
    </div>
    </div>



    <div class="layui-form-item layui-form-text">
    <label class="layui-form-label">详细说明</label>
    <div class="layui-form-mid layui-word-aux">你可以输入<span>2048</span>个字,现在剩余<span id="word">2048</span>个</div>

    <div class="layui-input-block">
    <textarea placeholder="请输入内容" id="xxnr" class="layui-textarea"></textarea>
    </div>
    </div>

    <div class="layui-form-item">
    <div class="layui-input-block">
    <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
    <button type="reset" class="layui-btn layui-btn-primary">重置所有</button>
    </div>
    </div>
    </form>


    <script src="//res.layui.com/layui/build/layui.js" charset="utf-8"></script>
    <script>layui.use(['form', 'layedit', 'laydate'], function() {
    var form = layui.form(),
    layer = layui.layer,
    layedit = layui.layedit,
    laydate = layui.laydate;

    //自定义验证规则
    form.verify({
    title: function(value) {
    if(value.length < 5) {
    return '标题至少得5个字符啊';
    }
    if(value.length > 50) {
    return '标题也太长了吧';
    }
    },
    pass: [/(.+){6,12}$/, '密码必须6到12位']
    });

    //创建一个编辑器
    layedit.build('LAY_demo_editor');

    //监听提交
    form.on('submit(demo1)', function(data) {
    layer.alert(JSON.stringify(data.field), {
    title: '最终的提交信息'
    })
    return false;
    });

    });</script>

    </body>
    </html>