博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
《The Missing Manual Javascript 》 - 书摘精要
阅读量:6478 次
发布时间:2019-06-23

本文共 6455 字,大约阅读时间需要 21 分钟。

(P23) <  script   type = "text/javascript  "> ***** </  script  >

 

(P26) <  script   type = "text/javascript  " src = "sample.js"></  script   >

 

(P61)

“push()” —— 在数据最后添加;

“unshift()” —— 在数组头部添加;

 

(P63)

“pop()” —— 从数组尾部删除;

“shift” —— 在数据头部删除;

 

(P64) “Splice()” —— 指定位置添加或删除;

 

(P103) A function can only return one value;

 

(P117) navigator.userAgent

 

(P119) string.slice(start, end); (end --> last letter's position + 1);

 

(P131) In Jav  script  , a null value is treated the same as false;

 

(P132) string.replace(regex, 'replace');

 

(P135)

Number();

 

parseInt() —— will try to change even a string with letters to a number, as long as the string begins will numbers.

 

(P137)

“Math.ceil()” —— Up

“Math.floor” —— Down

 

(P138) Math.random();

 

(P140) new Date() retrieves the current time and date as determined by each visitor's computer;

 

(P172) $('selector')

 

(P176)

Descendent Selectors —— $('#navBar a')

 

Child Selectors —— $('body > p')

 

Adjacent Selectros —— $('h2 + div')

 

Attribute Selectors —— $('img[alt]') $('Input[type=text]')

 

[attribute ^= value] —— attribute begins with a value;

 

[attribute $= value] —— attribute ends with a value;

 

[attribute *= value] —— attribute contains a value anywhere;

 

(P178)

:even —— Odd

:not() —— $('a:not(.navButton)');

:has() —— $('li:has(a)');

:contains() —— $('a:contains(click Me!)');

:hidden —— $('div:hidden').show();

:visible

 

(P181)

.html() —— works like DOM's innerHTML property;

 

.text() —— actually display the brackets and tag names on the page;

 

.append() —— add HTML as the last child element of the selected element;

 

.prepend() —— add HTML as the last child element of the selected element;

 

.before() .after() —— outside of a selection, either before or after;

 

(P183) .remove() —— removema selected element;

 

(P194) .clone() —— make a copy of a selected element;

 

(P185)

.addClass() —— add a special class to an element;

 

.removeClass() —— remove a special class from an selected elements;

 

.targetClass() —— add or remove;

 

(P186) .css() —— var brColor = $('#main').css('background-color');

 

(P190)

.attr() —— let you read a specified HTML attribute. let you set the attribute;

 

.removeAttr() —— remove an attribute;

 

(P191)

$(document).ready(function() { ...... }); —— make sure that the HTML for the page has loaded before your Java        script         program runs;

 

(P193)

$('img').fadeOut() —— Cause an element to disappear slowly;

 

$('selector').each();

 

(P194)

$('selector').each(function() { ...... });  —— jQuery's each() function lets you loop through a selection of page elements add perform a series of tasks on each element;

 

(P195)

$(this) —— You'll use the $(this) keyword almost every time you use the each();

 

(P201) Javascrip is an event-driven language;

 

(P203) Mouse Events —— click、dblclick、mousedown、mouseup、mouseover、mouseout、mousemove;

 

(P204) Document/Window Events —— load (the load event fires when the Web Browser finishes downloading all of a web page's files)、resize、scroll、unload;

 

(P205) Form Events —— submit、reset、change、focus、blur (the blue event is the opposite of focus. It's triggered when you exit a currently focused field.);

 

(P206) Keyboard Events —— keypresss()、keydown()、keyup();

 

(P207)

Event handler names are created by simply adding the word on to the beginning of the event;

 

You can think of "on" as "when";

 

(P211) When you assign a function to an event, you omit the () that you normally add to the end of a function's name to call it;

 

(P213) $('a').mouseover(function() { ...... });

 

(P218) $(document).ready(function() { ...... });

 

(P220) $('#selector').hover(function1, function2);

 

(P221) $('#selector').toggle(function1, function2); —— It responds to clicks;

 

(P223) eventobject.preventDefault();

 

(P224) $('#selector').unbind('event');

 

(P226)

$('#selector').bind('click', myData, functionName);

 

$('#selector').bind('click', functionName) = $('#selector').click(functionName);

 

(P230) .next() —— finds the tag immediately following the current tag;

 

(P243) jQuery's user Interface library includes an official set of add-on effects. It builds on jQuery's basic features and offers more eye-catching effects;

 

(P243) Basic showing and Hinding —— show()、hide()、toggle();

 

(P244)

Fading Elements In and Out —— fadeIn()、fadeOut()、fadeTo();

 

fadeTo() —— must supply a speed value; must supply a second value from 0 to 1);

 

If you fade an selement to 0 opacity, the element is no longer visible, but the sapce it accupied on the page remains;

 

(P245) Sliding Events —— SlideDown()、SlideUp()、SlideToggle();

 

(P246) The Callback function is passed as the second argument to most effects;

 

(P246) .animate() —— lets you animate any CSS property;

 

(P247) In order to animate a position of an element using the CSS left, right, top or bottom properties, you must set that elemetns CSS position to either absolute or relative. Those are the only two positioning properties that let you assign positioning values to them;

 

(P259) ;

 

(P281) createing new windows —— open(URL, name, properties);

 

(P282) Don't include any spaces in the string defining the new window's properties;

 

(P283) Firefox and Internet Explorer normally don't let you hide the status bar, so it's always visible in the browsers;

 

(P284) window object methods —— close()、blur()、focus()、moveBy()、moveTo()、resizeBy()、resizeTo()、scrollBy()、scrollTo();

 

(P299) $('#selector').find('tagName') —— search for another element include the current element;

 

(P300) The CSS "cursor" property lets you assign the type of cursor the browser uses when the mouse is over a particular element;

 

(P306) $('#selector tagName: has (tarName)'); —— Let's you select tags that contain another specific tag inside them;

 

(P309) text fields, password fields, radio buttons, checkboxes and submit buttons all share the <input> tag, and you specify which one with the type attribute.

 

(P312) jQuery includes lots of selectors to make it easy to work with specific types of form fields —— :input、:text、:password、:radio、:checkbox、:submit、:image、:reset、:botton、:file、:hidden;

 

(P313) jQuery provides a few very useful filters that find form fields matching a prticular state —— :checked、:selected;

 

(P314) $('selector').val() —— Both set and read the value of a form field;

 

(P315) Form Events —— submit()、focus()、blur()、click()、change();

 

(P380) This method is particular good if you want to dynamically generage tooltips from a datatbase or a server-side program. You don't have to point to a real web pages. You can point to a dynamic page;

转载于:https://www.cnblogs.com/ado-geek/archive/2012/05/17/2506620.html

你可能感兴趣的文章
python 测试驱动开发的简单例子
查看>>
设计模式:观察者模式
查看>>
JDBC中驱动加载的过程分析
查看>>
Aes 加密简单例子
查看>>
AE 线编辑
查看>>
python 回溯法 子集树模板 系列 —— 15、总结
查看>>
软件设计之UML—UML的构成[上]
查看>>
蚂蚁金服硅谷ATEC科技大会:看技术如何带来平等的机会
查看>>
[SPLEB]CodeSmith原理剖析(1)
查看>>
Spring的AOP原理
查看>>
探秘IntelliJ IDEA 13中的版本控制——Subversion 1.8
查看>>
centos 时区设置
查看>>
老李分享:Eclipse中开发性能测试loadrunner脚本
查看>>
nginx上部署vue项目
查看>>
MySQL 数据文件目录文件类型介绍
查看>>
基于NodeJs的微信第三方平台认证授权流程
查看>>
4月第一周国内域名解析商Top10:万网域名总量将破160万
查看>>
10月国内操作系统市场份额:Win XP份额减少至50.06%
查看>>
.top域名注册量15强:西部数码涨幅超40万 增势惊人
查看>>
python 命令行参数实例
查看>>