工作就是一個學習的過程。
在這個過程中,你可以學到新的知識,你也可以溫習你已經擁有的知識。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
$(":first");
others :first-child. :last
4、jquery css()
the css()
method sets or returns one or more style properties for the selected
.css("propertyname")
.css("propertyname","value")
.css({"propertyname":"value","propertyname":"value",.....})
5、jquery text()
the
text() method sets or renturns the text content of the selected
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
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
$(selector).text(function(index,currentcontent)); set text content
using a function;
6、jquery find()
the find()
method returns descendant elements of the selected
$(selector).find(filter);
note: to return multiple
descendants, separate each expression with a comma.
7、jquery slidetoggle()
the
slidetoggle() method toggles between slideup() and slidedown() for the selected
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 對象。
為了我所愛的,要學會愛我說不愛的!!