• 项目中遇到的问题


    1.jQuery UI中,使用dialog弹出框,如果涉及到asp。net页面传值,提交表单时,会无法获取到textbox的值,他会重新刷新页面。这时,如果还是要实现弹出框的话,可以不使用jQuery UI,用一个点击事件,先将弹出层隐藏,在点击事件发生时,再将弹出层show显示出来,背景可以用一个大的透明层(设置大小,绝对定位以及Z轴坐标)做背景,这样就可以做到和jQuery UI弹出框一样的效果。

    2.表格细节问题,单元格与单元格之间有空隙,通过设置cellspacing和paddingspacing为0来解决。一个单元格占上一行两个单元格的位置,用rowspan="2"来解决,colspan="2"

    3.在jQuery表格数据循环时,注意他的parent和chidren

    4.text-shadow:0px 1px 0px rgba(0, 0, 0, 0.35);     文字加阴影

    box-shadow:0px 1px 0px 0px rgba(255, 255, 255, 0.5) inset;    层加阴影

      圆角边框:border-radius:4px;

    5.背景色渐变:background:linear-gradient(#54B3FF, #0078D9) repeat scroll 0% 0% transparent;

    6.三元表达式:var now=new Date();

          $("#11").html("good"+((now.getHours()>17) ? "eveing":"afternone"));     //获取当前时间,如果当前时间的小时>17,则输出:之前,否则,冒号之后

    7.取得一个随机数,用这个随机数拼成字符串返回,例如

    $("img").attr("src",function(){return "img/0"+Math.floor(Math.random()*4+1)+".jpg"});

    Math.random()是取得0到1之间一个随机数,Math.floor()是取得这个随机数乘以4+1的整数部分

    8.复制元素节点,例如购物车的设计,表格的设计。都用到clone

    clone();新复制出来的节点不具有原有节点的任何功能。如果clone(true),的话,新复制得到的节点也具有原有节点的功能

    9.border-collapse:

    描述
    separate 默认值。边框会被分开。不会忽略 border-spacing 和 empty-cells 属性。
    collapse 如果可能,边框会合并为一个单一的边框。会忽略 border-spacing 和 empty-cells 属性。
    inherit 规定应该从父元素继承 border-collapse 属性的值。

    10.jquery中的trigger函数,实现页面加载完DOM后,自动实现触发性事件,不必用户进行任何操作。

    11.jquery表单验证插件:jquery.validate.js和jquery.validate.messages_cn.js

       如果要使表单在提交数据时触发验证,需要加入

    $("#frmV").validate({

       rules:{   username:{required:true,minlength:6},

                  email:{required:true,email:true}   }

      errorPlacement:function(error,element){

        error.appendTo(element.siblings("span"));

    }

    });

    12.Form表单插件:

    引进表单插件后,提交数据时,只需要写$("#form1").ajaxForm();

    13.cookie插件

    14.搜索插件AutoComplete

    15.在有了这个

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">标记的时候,说明这里引用的JS以及CSS都要符合编码规范,有些JS编写不符合规范,可能会导致

    无法正常运行。

    解决这个问题的方法:这是因为加入DOCTYPE申明后,js里是不能使用document.body的,一定要改成document.documentElement,还有就是加"px"。

    修改前:
    ...
    width = document.body.clientWidth;
    height = document.body.clientHeight;
    Hoffset = img1.offsetHeight;
    Woffset = img1.offsetWidth;
    img1.style.left = xPos + document.body.scrollLeft;
    img1.style.top = yPos + document.body.scrollTop;
    ...
    修改后:
    ...
    width = document.documentElement.clientWidth;
    height = document.documentElement.clientHeight;
    Hoffset = qingrenjie_pd.offsetHeight;
    Woffset = qingrenjie_pd.offsetWidth;
    img1.style.left = xPos + document.documentElement.scrollLeft + "px";
    img1..style.top = yPos + document.documentElement.scrollTop + "px";
  • 相关阅读:
    S2 第二章数据库的实现
    理解ThreadLocal(之二)
    理解ThreadLocal(之一)
    save(),saveOrUpdate(),merge()的区别
    Hibdernate入门
    Hibernate第一个例子
    在运行Hibernate Hello World程序的时候,抛如下错误: view plain Exception in thread "main" org.hibernate.exception.LockAcquisitionException 解决方法
    Oracle函数
    UDP
    多线程下真正的单例
  • 原文地址:https://www.cnblogs.com/eyunhua/p/3706621.html
Copyright © 2020-2023  润新知