《The Missing Manual Javascript 》 - 书摘精要
来源:广州中睿信息技术有限公司官网
发布时间:2012/10/21 23:25:16 编辑:admin 阅读 1305
(P23)<scripttype="text/javascript">*****</script>(P26)<scripttype="text/javascript"src="s

(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) www.ajaxload.info;

 

(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;

联系我们CONTACT 扫一扫
愿景:成为最专业的软件研发服务领航者
中睿信息技术有限公司 广州•深圳 Tel:020-38931912 务实 Pragmatic
广州:广州市天河区翰景路1号金星大厦18层中睿信息 Fax:020-38931912 专业 Professional
深圳:深圳市福田区车公庙有色金属大厦509~510 Tel:0755-25855012 诚信 Integrity
所有权声明:PMI, PMP, Project Management Professional, PMI-ACP, PMI-PBA和PMBOK是项目管理协会(Project Management Institute, Inc.)的注册标志。
版权所有:广州中睿信息技术有限公司 粤ICP备13082838号-2