码迷,mamicode.com
首页 > 编程语言 > 详细

Jquery and Javascript Notes

时间:2014-05-10 06:32:59      阅读:321      评论:0      收藏:0      [点我收藏+]

标签:des   style   code   java   tar   ext   

工作就是一个学习的过程。

在这个过程中,你可以学到新的知识,你也可以温习你已经拥有的知识。JQuery Notes

是一个工作笔记。希望能帮助自己提升技术。会有更新。。。。。

 

1、JQuery attr() Method

           The attr() method sets or returns attributes and values of the selected elements.
           Return the value of an attribute;   $(selector).attr(attribute);
           Set the attribute and value;        $(selector).attr(attribute,value);
           Set attribute and value using a function    $(selector).attr(attribute,function(index,currentvalue))
           Set multiple attributes and values   $(selector).attr({attribute:value,attribute:value,....});

2、JQuery children() Method
          The children() method returns all direct children of the selected element.
          $(selector).children(filter);

3、jQuery :first Selector
         The :first selector selects the first element.
         $(":first");  others  :first-child. :last

4、JQuery css() Method
         The css() method sets or returns one or more style properties for the selected elements.
         .css("propertyname")
         .css("propertyname","value")
         .css({"propertyname":"value","propertyname":"value",.....})

5、JQuery text() Method
          The text() method sets or renturns the text content of the selected elements.
          When this method is used to return content. it returns the text content of all matched elements.(HTML markup will be removed)
          When this method is used to set content, it overwrites the content of all matched elements.
          Tip: To set or return the innerHTML (text + HTML) of the selected elements, use the html() method.
          $(selector).text();  return text content
          $(selector).text(content); set text content
          $(selector).text(function(index,currentcontent));  set text content using a function;

6、JQuery find() Method
         The find() method returns descendant elements of the selected element.
         $(selector).find(filter);

         Note: To return multiple descendants, separate each expression with a comma.

7、jQuery slideToggle() Method
         The slideToggle() method toggles between slideUp() and slideDown() for the selected elements.
         This method checks the selected elements for visibility. slideDown() is run if an element is hidden. slideUp() is run if an element is visible -

         This creates a toggle    effect.

 

 Javascript notes start

1、 indexOf() 方法: 可返回某个指定字符串值 在字符串中 首次 出现的位置。
   note: 如果在数组中没找到字符串则返回 -1。
   语法 array.indexOf(item,start) 
   item  必须要填。查找的元素。  start 可选的整数参数。规定在字符串中开始检索的位置。它的合法取值是 0 到 stringObject.length - 1。
   如省略该参数,则将从字符串的首字符开始检索。
  
2、 lastindexOf() 方法可返回一个指定的字符串值最后出现的位置,在一个字符串中的指定位置从后向前搜索。
   如果要检索的字符串值没有出现,则该方法返回 -1。  
   语法同上

 

3、Browser 对象  

(1)、History 对象   是window 对象的一部分,可通过 window.history 属性对其进行访问。      

           History 对象包含用户(在浏览器窗口中) 访问过的URL   

           length : 返回历史列表的网址数   

          back() : 加载history 列表中的前一个URL  (相当于后退) 

          forward() : 加载history 列表中的下一个URL (前进)  

          go()   : 加载history 列表中的某个具体页面  (跳转指定的某个位置)

(2)、Location 对象      

        Location 对象包含有关当前 URL 的信息。 Location 对象是 window 对象的一部分,可通过 window.Location 属性对其进行访问。      

        hash : 返回一个URL的锚部分   

        host : 返回一个URL的主机名 和 端口   

        hostname : 返回URL的主机名   

        href : 返回完整的URL   

        pathname : 返回的URL路径名   

       port : 返回一个URL服务器使用的端口号   

       protocol : 返回一个URL协议   

       search : 返回一个URL的查询部分      

       assign() : 载入一个新的文档   

       reload() : 重新载入当前文档   

       replace() : 用新的文档替换当前文档  

 

(3)、Screen 对象  是window 对象的一部分,可通过 window.screen 属性对其进行访问。      

      Screen 对象包含有关客户端显示屏幕的信息。      

      availHeight : 返回屏幕的高度(不包括Windows任务栏)      

      availWidth : 返回屏幕的宽度(不包括Windows任务栏)      

      colorDepth  返回目标设备或缓冲器上的调色板的比特深度      

      height  返回屏幕的总高度      

      pixelDepth  返回屏幕的颜色分辨率(每象素的位数)       

      width  返回屏幕的总宽度  

(4)、Navigator 对象属性  Navigator 对象包含有关浏览器的信息。          

      Navigator 对象属性   属性  说明   

      appCodeName  返回浏览器的代码名   

      appName  返回浏览器的名称   

      appVersion  返回浏览器的平台和版本信息  

      cookieEnabled  返回指明浏览器中是否启用 cookie 的布尔值   

      platform  返回运行浏览器的操作系统平台   

      userAgent  返回由客户机发送服务器的user-agent 头部的值   

      Navigator 对象方法   方法  描述   

      javaEnabled()  指定是否在浏览器中启用Java   

      taintEnabled()  规定浏览器是否启用数据污点(data tainting)   

(5)、Window 对象

       Window 对象表示浏览器中打开的窗口。

       如果文档包含框架(<frame> 或 <iframe> 标签),浏览器会为 HTML 文档创建一个 window 对象,并为每个框架创建一个额外的 window 对象。

 

为了我所爱的,要学会爱我说不爱的!!

 

 

 

 

Jquery and Javascript Notes,布布扣,bubuko.com

Jquery and Javascript Notes

标签:des   style   code   java   tar   ext   

原文地址:http://www.cnblogs.com/htwdz-qhm/p/3719329.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!