关闭

关闭

关闭

封号提示

内容

首页 HeadFirst_Javascript

HeadFirst_Javascript.pdf

HeadFirst_Javascript

jack20039 2011-10-10 评分 0 浏览量 0 0 0 0 暂无简介 简介 举报

简介:本文档为《HeadFirst_Javascriptpdf》,可适用于IT/计算机领域,主题内容包含AdvancePraiseforHeadFirstJavaScript“Sopracticalanduseful,andsowellexplaine符等。

AdvancePraiseforHeadFirstJavaScript“Sopracticalanduseful,andsowellexplainedThisbookdoesagreatjobofintroducingacompletenewbietoJavaScript,andit’sanothertestamenttoHeadFirst’steachingstyleOutoftheotherJavaScriptbooks,HeadFirstJavaScriptisgreatforlearning,comparedtootherreferencebooksthesizeofaphonebook”AlexLee,Student,UniversityofHouston“AnexcellentchoiceforthebeginningJavaScriptdeveloper”FletcherMoore,WebDeveloperDesigner,GeorgiaInstituteofTechnology“Yetanothergreatbookintheclassic‘HeadFirst’style”TWScannell“JavaScripthaslongbeentheclientsideenginethatdrivespagesontheWeb,butithasalsolongbeenmisunderstoodandmisusedWithHeadFirstJavaScript,MichaelMorrisongivesastraightforwardandeasytounderstandintroductionofthislanguage,removinganymisunderstandingthateverexistedandshowinghowtomosteffectivelyuseittoenhanceyourwebpages”AnthonyTHoldenerIII,Webapplicationsdeveloper,andtheauthorofAjax:TheDefinitiveGuide“Awebpagehasthreepartscontent(HTML),appearance(CSS),andbehaviour(JavaScript)HeadFirstHTMLintroducedthefirsttwo,andthisbookusesthesamefunbutpracticalapproachtointroduceJavaScriptThefunwayinwhichthisbookintroducesJavaScriptandthemanywaysinwhichitreinforcestheinformationsothatyouwillnotforgetitmakesthisaperfectbookforbeginnerstousetostartthemontheroadtomakingtheirwebpagesinteractive”StephenChapman,OwnerFelgallPtyLtd,JavaScripteditor,aboutcom“ThisisthebookI’vebeenlookingfortorecommendtomyreadersItissimpleenoughforcompletebeginnersbutincludesenoughdepthtobeusefultomoreadvancedusersAnditmakestheprocessoflearningfunThismightjustbetheonlyJavaScriptbookyoueverneed”JulieLBaumler,JavaScriptEditor,BellaOnlinecomPraiseforHeadFirstHTMLwithCSSXHTML“EricandElisabethFreemanclearlyknowtheirstuffAstheInternetbecomesmorecomplex,inspiredconstructionofwebpagesbecomesincreasinglycriticalElegantdesignisatthecoreofeverychapterhere,eachconceptconveyedwithequaldosesofpragmatismandwit”KenGoldstein,ExecutiveVicePresidentManagingDirector,DisneyOnline“TheWebwouldbeamuchbetterplaceifeveryHTMLauthorstartedoffbyreadingthisbook”LDavidBaron,TechnicalLead,LayoutCSS,MozillaCorporation,http:dbaronorg“I’vebeenwritingHTMLandCSSfortenyearsnow,andwhatusedtobealongtrialanderrorlearningprocesshasnowbeenreducedneatlyintoanengagingpaperbackHTMLusedtobesomethingyoucouldjusthackawayatuntilthingslookedokayonscreen,butwiththeadventofwebstandardsandthemovementtowardsaccessibility,sloppycodingpracticeisnotacceptableanymorefromabusinessstandpointorasocialresponsibilitystandpointHeadFirstHTMLwithCSSXHTMLteachesyouhowtodothingsrightfromthebeginningwithoutmakingthewholeprocessseemoverwhelmingHTML,whenproperlyexplained,isnomorecomplicatedthanplainEnglish,andtheFreemansdoanexcellentjobofkeepingeveryconceptateyelevel”MikeDavidson,PresidentCEO,Newsvine,Inc“Oh,greatYoumadeanXHTMLbooksimpleenoughaCEOcanunderstanditWhatwillyoudonextAccountingsimpleenoughmydevelopercanunderstanditNextthingyouknowwe’llbecollaboratingasateamorsomething”JaniceFraser,CEO,AdaptivePath“Thisbookhashumor,andcharm,butmostimportantly,ithasheartIknowthatsoundsridiculoustosayaboutatechnicalbook,butIreallysensethatatitscore,thisbook(oratleastitsauthors)reallycarethatthereaderlearnthematerialThiscomesacrossinthestyle,thelanguage,andthetechniquesLearning–realunderstandingandcomprehension–onthepartofthereaderisclearlytopmostinthemindsoftheFreemansAndthankyou,thankyou,thankyou,forthebook’sstrong,andsensibleadvocacyofstandardscomplianceIt’sgreattoseeanentrylevelbook,thatIthinkwillbewidelyreadandstudied,campaignsoeloquentlyandpersuasivelyonbehalfofthevalueofstandardscomplianceinwebpagecodeIevenfoundinhereafewgreatargumentsIhadnotthoughtof–onesIcanrememberandusewhenIamasked–asIstillam–‘what’sthedealwithcomplianceandwhyshouldwecare’I’llhavemoreammonow!IalsolikedthatthebooksprinklesinsomebasicsaboutthemechanicsofactuallygettingawebpageliveFTP,webserverbasics,filestructures,etc”RobertNeer,DirectorofProductDevelopment,MoviescomIfyouhaven’treadthisbookyet,andyou’renewtoJavaScript,werecommedthatyoudoPraiseforHeadFirstHTMLwithCSSXHTML““Freeman’sHeadFirstHTMLwithCSSXHTMLisamostentertainingbookforlearninghowtobuildagreatwebpageItnotonlycoverseverythingyouneedtoknowaboutHTML,CSS,andXHTML,italsoexcelsinexplainingeverythinginlayman’stermswithalotofgreatexamplesIfoundthebooktrulyenjoyabletoread,andIlearnedsomethingnew!”NewtonLee,EditorinChief,ACMComputersinEntertainment,http:wwwacmcieorg“MywifestolethebookShe’sneverdoneanywebdesign,sosheneededabooklikeHeadFirstHTMLwithCSSXHTMLtotakeherfrombeginningtoendShenowhasalistofwebsitesshewantstobuild–forourson’sclass,ourfamily,IfI’mlucky,I’llgetthebookbackwhenshe’sdone”DavidKaminsky,MasterInventor,IBM“BewareIfyou’resomeonewhoreadsatnightbeforefallingasleep,you’llhavetorestrictHeadFirstHTMLwithCSSXHTMLtodaytimereadingThisbookwakesupyourbrain”PaulineMcNamara,CenterforNewTechnologiesandEducation,FribourgUniversity,Switzerland“Theinformationcoveredinthisbookisthesamematerialtheprosknow,buttaughtinaneducationalandhumorousmannerthatdoesn’tevermakeyouthinkthematerialisimpossibletolearnoryouareoutofyourelement”ChristopherSchmitt,AuthorofTheCSSCookbookandProfessionalCSS,schmittchristopherorg“HeadFirstHTMLwithCSSXHTMLisathoroughlymodernintroductiontoforwardlookingpracticesinWebpagemarkupandpresentationItcorrectlyanticipatesreaders’puzzlementsandhandlesthemjustintimeThehighlygraphicandincrementalapproachpreciselymimicsthebestwaytolearnthisstuff:makeasmallchangeandseeitinthebrowsertounderstandwhateachnewitemmeans”DannyGoodman,authorofDynamicHTML:TheDefinitiveGuideOtherrelatedbooksfromO’ReillyJavaScript:TheDefinitiveGuideJavaScriptPocketReferenceLearningJavaScriptJavaScriptDHTMLCookbookOtherbooksinO’Reilly’sHeadFirstseriesHeadFirstJavaHeadFirstObjectOrientedAnalysisandDesign(OOAD)HeadRushAjaxHeadFirstHTMLwithCSSandXHTMLHeadFirstDesignPatternsHeadFirstServletsandJSPHeadFirstEJBHeadFirstPMPHeadFirstSQLHeadFirstSoftwareDevelopmentHeadFirstC#Beijing•Cambridge•Kln•Paris•Sebastopol•Taipei•TokyoHeadFirstJavaScriptWouldn’titbedreamyiftherewasawaytolearnJavaScriptfromabookwithoutwantingtosetfiretoithalfwaythroughandswearingofftheWebforeverIknow,it’sprobablyjustafantasyMichaelMorrisonHeadFirstJavaScriptbyMichaelMorrisonCopyrightO’ReillyMedia,IncAllrightsreservedPrintedintheUnitedStatesofAmericaPublishedbyO’ReillyMedia,Inc,GravensteinHighwayNorth,Sebastopol,CAO’ReillyMediabooksmaybepurchasedforeducational,business,orsalespromotionaluseOnlineeditionsarealsoavailableformosttitles(safarioreillycom)Formoreinformation,contactourcorporateinstitutionalsalesdepartment:()orcorporateoreillycomSeriesCreators:KathySierra,BertBatesSeriesEditor:BrettDMcLaughlinEditor:CatherineNolanDesignEditor:LouiseBarrCoverDesigners:LouiseBarr,SteveFehlerProductionEditor:SandersKleinfeldProofreader:ColleenGormanIndexer:JulieHawksPageViewers:MasheedMorrison(wife),family,andpetfishPrintingHistory:December:FirstEditionTheO’ReillylogoisaregisteredtrademarkofO’ReillyMedia,IncTheHeadFirstseriesdesignations,HeadFirstJavaScript,andrelatedtradedressaretrademarksofO’ReillyMedia,IncManyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimedastrademarksWherethosedesignationsappearinthisbook,andO’ReillyMedia,Inc,wasawareofatrademarkclaim,thedesignationshavebeenprintedincapsorinitialcapsWhileeveryprecautionhasbeentakeninthepreparationofthisbook,thepublisherandtheauthorassumenoresponsibilityforerrorsoromissions,orfordamagesresultingfromtheuseoftheinformationcontainedhereinNorocks,stickfigures,cubepuzzles,ormachomoviegoerswereharmedinthemakingofthisbookJustme,butIcanhandleitI’mwiryISBN:ISBN:MMyfamilyknowshowtocelebrateabookreleasebutmykoifishcouldn’tcarelessThisbookusesRepKover,adurableandflexiblelayflatbindingTMTMTothefolksatNetscapewho,waybackinthelastcentury,dreamedthattheWebcouldbemuchmorethanabigonlinebookwithabunchoflinkedpagesthatdon’tdoanythingOfcourse,theyalsodreamedupthathorrific<blink>tagdaretodream,justdon’tgettoocarriedaway!viiitheauthorAuthorofHeadFirstJavaScriptMichaelMorrisonhasbeentinkeringwithcomputerssincehisfirstPC,aTIA,completewithitssupremelyergonomickeyboard,stateoftheartblackandwhiteTV“monitor,”andsweetcassettetapestoragesystemHehasownedandtinkeredwithafewmorecomputerssincethen,butstilllongsforthedaysofplayingParseconthatTIinbetweenepicNerffootballgamesinthebackyardNowMichaelisallgrownupandhasmovedontomuchmorematureinterests,suchascreatinginteractivewebapplicationsandskateboardingCut,bruised,andoftenlimping,heapproachestechchallengeswiththesamerecklessintensityashighrisksportsAfterdevelopingafewvideogames,inventingacoupleoftoys,writingdozensofcomputerbooks,andcreatingnumerousonlinecourses,MichaelfinallyfeltreadytotackleHeadFirstJavaScriptHenolongertrustshisfeelingsAsitturnsout,you’reneverreallyreadytowriteaHeadFirstbookThebestyoucanbeisreadytopoptheredpillandentertheMatrixthatisHeadFirstHavingemergedfromtheothersidewithafewintellectualbruisestoaddtohisrealones,Michaelwillneverlookatlearning(orteaching)thesameagainAndhe’sthrilledaboutthatfactRightaboutnowhe’swithhiswifenexttotheirkoipondreflectingonthewondersoftheinteractiveWebMichaelMorrison,childJavaScriptprodigyMichaelMorrison,fullsizenerdwhorefusestogrowuptableofcontentsixTableofContents(Summary)TableofContents(therealthing)IntroWhoisthisbookforxxivWeknowwhatyou’rethinkingxxvMetacognitionxxviiBendyourbrainintosubmissionxxixReadmexxxThetechnicalreviewteamxxxiiAcknowledgmentsxxxiiiIntroxxiiitheinteractiveweb:ReactingtotheVirtualWorldstoringdata:EverythingHasItsPlaceexploringtheclient:BrowserSpelunkingdecisionmaking:IfThere’saForkintheRoad,TakeItlooping:AttheRiskofRepeatingMyselffunctions:Reduce,Reuse,Recycleformsandvalidation:GettingtheUsertoTellAllwranglingthepage:SlicingandDicingHTMLwiththeDOMbringingdatatolife:ObjectsasFrankendatacreatingcustomobjects:HavingItYourWaywithCustomObjectskillbugsdead:GoodScriptsGoneWrongdynamicdata:TouchyFeelyWebApplicationsYourbrainonJavaScriptYou’resittingaroundtryingtolearnsomething,butyourbrainkeepstellingyouallthatlearningisn’timportantYourbrain’ssaying,“Betterleaveroomformoreimportantthings,likewhichwildanimalstoavoidandwhethernakedwaterskiingisabadidea”SohowdoyoutrickyourbrainintothinkingthatyourlifereallydependsonlearningJavaScripttableofcontentsxReactingtotheVirtualWorldTiredofthinkingoftheWebintermsofpassivepagesBeenthere,donethatThey’recalledbooksAndthey’regoodforreading,learninglotsofgoodthingsButthey’renotinteractiveAndneitheristheWebwithoutalittlehelpfromJavaScriptSure,youcansubmitaformandmaybedoatrickhereandtherewithsomecraftyHTMLandCSScoding,butyou’rereallyjustplayingWeekendatBernie’sproppingupalifelesswebpageRealliveinteractivityrequiresabitmoresmartsandalittlemoreworkbutithasamuchbiggerpayofftheinteractiveweb(Online)peoplehaveneedsLiketalkingtoabrickwallnothinghappensButJavaScripttalksbackLights,camera,interaction!Usethe<script>tagtotellthebrowseryou’rewritingJavaScriptYourwebbrowsercanhandleHTML,CSS,ANDJavaScriptMan’svirtualbestfriendneedsYOURhelpMakingiRockinteractiveCreatetheiRockwebpageTestdriveJavaScriptevents:givingtheiRockavoiceAlertingtheuserwithafunctionAddtheiRockgreetingNowlet’smaketheiRockreallyinteractiveInteractionisTWOwaycommunicationAddafunctiontogettheuser’snameInstantreplay:whatjusthappenedTestdriveiRocktableofcontentsxiEverythingHasItsPlaceIntherealworld,peopleoftenoverlooktheimportanceofhavingaplacetostorealltheirstuffNotsoinJavaScriptYousimplydon’thavetheluxuryofwalkinclosetsandthreecargaragesInJavaScript,everythinghasitsplace,andit’syourjobtomakesureofitTheissueisdatahowtorepresentit,howtostoreit,andhowtofinditonceyou’veputitsomewhereAsaJavaScriptstoragespecialist,you’llbeabletotakeaclutteredroomofJavaScriptdataandimposeyourwillonitwithaflurryofvirtuallabelsandstoragebinsstoringdataYourscriptscanstoredataScriptsthinkindatatypesConstantsstaytheSAME,variablescanCHANGEVariablesstartoutwithoutavalueInitializeavariablewith“=”ConstantsareresistanttochangeWhat’sinanameLegalandillegalvariableandconstantnamesVariablenamesoftenuseCamelCasePlantheDuncan’sDonutswebpageAfirsttakeatthedonutcalculationsInitializeyourdataorelseNaNisNOTanumberYoucanaddmorethannumbersparseInt()andparseFloat()converttexttoanumberWhyareextradonutsbeingorderedDuncandiscoversdonutespionageUsegetElementById()tograbformdataValidatethewebform’sdataStriveforintuitiveuserinputtableofcontentsxiiBrowserSpelunkingSometimesJavaScriptneedstoknowwhat’sgoingonintheworldarounditYourscriptsmaybeginascodeinwebpagesbuttheyultimatelyliveinaworldcreatedbythebrowser,orclientSmartscriptsoftenneedtoknowmoreabouttheworldtheylivein,inwhichcasetheycancommunicatewiththebrowsertofindoutmoreaboutitWhetherit’sfindingoutthescreensizeoraccessingthebrowser’ssnoozebutton,scriptshaveanawfullottogainbycultivatingtheirbrowserrelationshipexploringtheclientClients,servers,andJavaScriptWhatcanabrowserdoforyouTheiRockneedstobemoreresponsiveTimersconnectactiontoelapsedtimeBreakingdownatimerSetatimerwithsetTimeout()Acloserlook:thesetTimeout()functionMultiplesizescreens,multiplecomplaintsUsethedocumentobjecttogettheclientwindow’swidthUsedocumentobjectpropertiestosettheclientwindowwidthSettheheightandwidthoftheiRockimageTheiRockshouldbesizedtothepageonresizeistriggeredwhenthebrowser’sresizedTheonresizeeventresizestherockHavewemetRecognizingtheuserEveryscripthasalifecycleCookiesoutliveyourscript’slifecycleCookieshaveanameandstoreavalueandcanexpireYourJavaScriptcanliveOUTSIDEyourwebpageGreettheuserwithacookiegreetUser()iscookiepowerednowDon’tforgettosetthecookie,tooCookiesaffectbrowsersecurityAworldwithoutcookiesTalktotheusersit’sbetterthannothingtableofcontentsxiiiIfThere’saForkintheRoad,TakeItdecisionmakingLuckycontestant,comeondown!"if"thisistruethendosomethingAnifstatementevaluatesaconditionandthentakesactionUseiftochoosebetweentwothingsYoucanmakemultipledecisionswithifAddinganelsetoyourifstatementVariablesdrivethestoryButpartofthestoryismissingCompoundingyourJavaScripteffortsTiereddecisionmakingwithifelseAnifcangoinsideanotherifYourfunctionscontrolyourpagesPseudocodeletsyoumapoutyouradventureStickfigureinequality!=Psst,I’vegotnothingtotellyou…CraftingdecisionswithcomparisonoperatorsComments,placeholders,anddocumentationCommentsinJavaScriptstartwithScopeandcontext:WheredatalivesCheckyouradventurevariablescoreWheredoesmydataliveChoiceoffiveNestingifelsecangetcomplicatedSwitchstatementshavemultiplecasesInsidetheswitchstatementAswitchystickfigureadventure:testdriveLifeisallaboutmakingdecisionsStoporgo,shakeorbake,pleabargainorgototrialwithouttheabilitytomakedecisions,nothingwouldevergetdoneItworksthesameinJavaScriptdecisionsallowscriptstodecidebetweendifferentpossibleoutcomesDecisionmakingdrivesthe“story”ofyourscripts,andeventhemostmundanescriptsinvolveastoryofsomesortDoyoutrustwhattheuserenteredandbookheratriponaSasquatchexpeditionordoyoudoublecheckthatmaybeshereallyjustwantedtorideabustoSaskatchewanThechoiceisyourstomake!tableofcontentsxivAttheRiskofRepeatingMyselfloopingXmarksthespotDéjàvualloveragainforloopsTreasurehuntingwithaforloopDissecttheforloopMandango:amachomovieseatfinderFirstcheckseatavailabilityLooping,HTML,andseatavailabilityMovieseatsasvariablesArrayscollectmultiplepiecesofdataArrayvaluesarestoredwithkeysFromJavaScripttoHTMLVisualizingMandangoseatsTestdrive:thesoloseatfinderToomuchofagoodthing:endlessloopsLoopsalwaysneedanexitcondition(ortwo!)A"break"intheactionBooleanoperatorlogicuncoveredLoopingforjusta"while"…untilaconditionismetBreakingdownthewhileloopUsetherightloopforthejobMovieseatdatamodelingAnarrayofanarray:twodimensionalarraysTwokeystoaccessDarraydataMandangoinDAnentiretheaterofmanlyseatsSomesayrepetitionisthespic

用户评论(0)

0/200

精彩专题

上传我的资料

每篇奖励 +1积分

资料评分:

/49
仅支持在线阅读

意见
反馈

立即扫码关注

爱问共享资料微信公众号

返回
顶部

举报
资料