周记 2015.07.04

1. Js获取当前日期时间及其它操作var myDate = new Date();

    myDate.getFullYear(); //获取完整的年份(4位,1970-????)

    myDate.getMonth(); //获取当前月份(0-11,0代表1月)

    myDate.getDate(); //获取当前日(1-31)

    myDate.getDay(); //获取当前星期X(0-6,0代表星期天)

    myDate.getTime(); //获取当前时间(从1970.1.1开始的毫秒数

    参考:http://www.cnblogs.com/carekee/articles/1678041.html

2. <script type="text/javascript" language="javascript">

     var gFlag=true;//全局变量,用于判断是否允许清除文本框内容

     //用于清除输入框中提示信息的方法

     function clearTip(){

         var oTxt=document.getElementByIdx_x_x("textfield");

         if(gFlag==true){

                oTxt.value="";

                gFlag=false;

         }

      }

  </script>

  <textarea name="textfield" cols="40" rows="5" onfocus="clearTip()">请输入对KKKKK的评论......</textarea>

   // 有些时候需要再定义一个失去焦点的事件,把默认值填上去。

   思考:是否会提交默认值?

   <input value="填写您的昵称" onfocus="cls()" onblur="res()">

   http://www.jbxue.com/article/25898.html


3. $("button").click(function(){

        $.ajax({

               type:'POST',

               url: "${content.contextPath}/orderReadReport/closeApply",

               data: "pkId="+pkId,

               success: function(result){

                        $.each(result, function(i, field){

                              $("div").append(field + " ");

                        });

              }

         });

    });

    1). Button绑定单击事件

    2). Ajax,注意,ajax后面直接加 ({ ; 没有function

    3). 回调函数

    4). 遍历数组的方式,参数

    5). 在div内部内容的后面添加field内容

    6). 返回值为json数组,返回值的处理

 

4. 定义DIV边框:

    .complaint {border:1px solid #00F} // complaint为class的属性

 

    设置一个css宽度为200px,css高度1px,红色实线边框的DIV盒子

     CSS代码:#divcss5{height:100px;width:200px;border:1px solid #F00}

     HTML代码对应片段:<div id="divcss5">我的高度为100px,宽度为200px</div>


5. $("#btnDiv").after("<div> </div>"); // 在id为btnDiv的元素后面添加一个div元素

    $("div[id='"+divId+"'] tr").last().remove(); // 删除id为divId的div的后代元素tr集合集合中的最后一个元素

    $("td[id='"+evaluateId+"']").html(""); // 使用html清空td中的元素

 

6. 开启子窗口:window.open(url,'评价界面','width=800,height=500');

    子窗口调用父窗口:window.opener.modifyBtn(pkId);

 

7. <table border="1" cellpadding="10"> // 设置表格边框宽度,及表格单元边界与单元内容之间的间距设置为 10 像素:

 

8. js中有些关键字不能作为方法或变量名称。

 

9. js文件中如果有错,所有的方法访问都会出问题,无法使用。当js中的方法无法使用时,可以考虑一下。

 

10. window.open("xx.asp","dd", "resizable=1,title =no,menubar=no,toolbar=yes,scrollbars=yes,width=640,height=450,left=70,top=25");

 

11. 判断js文件是否为undefined:

      方法一:if (typeof exp == "undefined") {} // 注意后面的undefined要加双引号,前面typeof exp 得到的是字符串。

      方法二:if (myObj == undefined) { } //


12. $无法使用:框架冲突,$被其他框架使用。估计是myeclipse引入了一个其他的框架把jQuery的$给覆盖掉了 ; jQuery.noConflict();是jQuery解决与其他框架冲突的方法

      为避免冲突,jQuery 只用 jQuery 调用 , <script> jQuery.noConflict(); </script>

 

13. <td rowspan=2> 狮子 </td> <td colspan=2>狮子</td>

 

14. 指定字体系列 : body {font-family: sans-serif;} ; 字体风格:ont-style:normal; 字体大小:font-size:60px;

 

15. Example:CSS鼠标手型效果 <a href="#" style="cursor:pointer">CSS鼠标手型效果</a><br/> 注:pointer也是小手鼠标,建议大家用pointer,因为它可以兼容多种浏览器。<br/>

 

posted @ 2015-07-04 11:00  Jtianlin  阅读(219)  评论(0编辑  收藏  举报