一些js和JQuery的方法

2022-07-13 03:57:13 字數 603 閱讀 8516

js: get-- innertext, innerhtml, value;  set-- innertext=?, innerhtml=?, value=?;

jquery: get-- text(); html(); val();  set-- text("?"); html("?"); val("?");  

.attr("屬性名稱","屬性值");

$("[name='表單名']").submit();  提交表單,選擇器可以使用其它,但是form必須有name屬性;

window.location.href="?";

window.parent.location.href="?";  在從框架中一部分跳轉到全頁面時候使用;

window.location.reload();   重新整理頁面,如有需要,提示是否提交資料;

location=location; (返回操作前)重新整理;

window.history.back();  頁面後退;

window.history.forward();  頁面前進;

window.history.go(?);  頁面跳轉(? : 1--前進1次,2--前進兩次,  -1,-2--後退,同理);

jquery一些方法

1,追加元素 prepend 在被選元素的開頭插入內容 after 在被選元素之後插入內容 before 在被選元素之前插入內容 引數可以為string 也可以為html 2,離開頁面時,提示 不是jquery方法 3,選擇元素 匹配id以aaa開頭 select id aaa 匹配id以aaa結尾...

jquery的一些實用方法

1,獲取瀏覽器型別與版本 使用 browser,browser.chrome 為true,表示當前為chrome瀏覽器,browser.mozilla 為true,表示當前為火狐瀏覽器,還可以通過 browser.version 方式獲取瀏覽器版本資訊。2,檢測瀏覽器是否屬於w3c盒子模型 瀏覽器的...

jQuery的一些靜態方法

該方法被繫結在jquery物件上,只能通過 noconflict 呼叫 noconflict function deep 如果傳入引數deep為ture,說明使用者解除window物件的jquery屬性對jquery物件的引用,執行 同樣的操作 if deep window.jquery jquer...