JavaScript教程 解释型或即时编译型的编程语言.docx
《JavaScript教程 解释型或即时编译型的编程语言.docx》由会员分享,可在线阅读,更多相关《JavaScript教程 解释型或即时编译型的编程语言.docx(77页珍藏版)》请在课桌文档上搜索。
1、JavaScript.1.Thau!CGI一Javascript,CGIavascript-WEB-JavascriptJavascript,_-Perl,C,C+JavaJavasript.Page1:Javascript.Page2:.Page3:-Page4:.JaVaSCriPtPage5:-2.:.Thau!-3Javascript.Javascript一JavascriptQ.if-then.JavasriptJavaJavascriptJavascriptJavascript-Javascript-3.0一3d-Javascript.Javascript.1.:Javascrip
2、t.2.:.3.:.4.:.JavaScript.5.:.3.:.Thau!JavaScript,.HTM1.JavaScript-HTM1.-JavaScript.HTMI_一JavaScript.scriptIanguage=nJavaScriptnX.Ianguage=zzJavaScriptzz.JavaScript一J1.*alert(better,stronger,faster,.Javascript._.1.:Javascript.2.:.3.:.4.:JaVaSCriPt.5.:-.4.JavaScript.Thau!,JTM1.JavaScript- /putupanaler
3、tbox,toshowhowtheyworkalert(Soo,IW川OVerthrOWmybrowser!);第2章Congratulations.,.HTM1. blahblahblah!-hidethisstufffromotherbrowsers.1.:Javascript.3:r;.JaVaSCriPt5,:-.5.:.Thau!JavaScript. JavaScript. JavaScript. JavaScript- Q JavaScript.JavaScriptJavaScript JavaScript. JavaScript. JavaScript.Page1:Javasc
4、ript.Page2:.Page3:.Page4:.JaVaSCriPtPage5:.JavaScript2.Thau!JavaScript-JavaScript一l2.::3Q.4.:.5.:.6.:if-then.7.:if-then.8.:if-then.9.:.10.:.11.:2.12.:.Thau!JavaScript-x=21xy=x+31,y,-5.-JavaScript.JavaScript.JavaScriptJavaScript.l2.:r3A:.5.:.6.:if-then.7.:if-then.8:if-then.9.:.10.:.11.:温.12.:._.Thau!
5、一hidemeJavaScript./here,showtouseJavaScripttowriteoutHTM1.document,writein(zzThemonkeydances);document,writein(secs_per_year);document,writein(,secondsperyear,zz);document.writeln().document,writeln().jdocument.writein(blah!)JHTM1.secs_per_year.JavaScript-_secs_per_yearJavaScriptJavaScript(,document
6、.write1n(zzsecs_peryearz,).JavaScript.secs_per_year_31,536,000.document,writeInO.HTM1.-JavaScript.(secs_per_min).secs_per_minJavaScript.document,writein(secs_per_min).JavaScript.Ir2.:,3.l.4.:.5.:.6.:if-then.7.:if-then.8.:if-then.9.:.10.:.11.:2.12.:r.4.Thau!varnice_monkey=Themonkeysmilesatyouandrecit
7、esShakespeare.varbad_monkey=Themonkeyscowlsatyouandburps.;document,writein(nice_monkey);varmonkey=prompt(z,What,sthemonkey,sname?,Themonkeyz,);-OK.-Whatsthemonkeysname?Themonkey1.varmonkey=prompt(zzWhat,sthemonkey*sname?,);vartechymonkey=monkey+demanding+tech;zrtechymonkeyThemonkey+demands,no,insist
8、suponreceiving+acomputerthatwon,tcrash,andahomemadebrowser!vartechy_monkey-monkey+demandingtech;vartechy_monkey-Themonkeydemands,no,insistsuponreceivingacomputerthatwon,tcrash,andahomemadebrowser!,;varitalic_hippy=hippy_monkey.italics();varshouting-hippy=hippy_monkey.toUpperCase();varred_bold_tech-b
9、old_tech.fontcolor(,red,);varitalic_hippy=+hippymonkey+”;JavaScript.document.writein(italic_hippy).JHTM1.-hippymonkey.string,fontcolor(,newcolor,)varred_bold_tech=zz+bold_tech+;varred_bold_tech-bold_tech.fontcolor(,red,);document,writein(bold_tech+);varbrokenbold=bold_tech+”;document,writein(brokenb
10、old);2:,.4.:.5.:.6.:if-then.7.:if-lhen-B.:if-then,.9.:.10.:r.11.:z2.12.:r5二.Thau!.HTM1.andj11ad-lib.51if-the.l2.:.3j.4.:.5.:.6.:if-then.7.:if-then.8.:if-then.9.:.10.:r.11.:J.12.:.6Jif-then.Thau!if-then_if(someconditionistrue)(dosomething;dosomething;dosomething;.if,(if.).-if-then-.if-then.1,2.::3.1.
11、4.:.5.:-.6.:if-then.7.:if-then.8.:if-then.9.:.10.:r.11.:2.12.:r.7.if-then.Thau!.yes.varmonkey_love=prompt(,zDoyoulovethemonkey?,Typeyesorno);if(monkey_love=yes)alert(zzWelcome!msogladyoucame!Please,readOri!);)Jnonkey_love_jnonkey_love.yes.JavaScriptJ11onkey-love.yes.(variable_lvariable_2)istrueifvar
12、iable_lisgreaterthanvariable_2(variable_lvariable_2)istrueifvariable_lislessthanvariable_2(variable_218)&(variable121)document,writeIn(/zvariable_lcanvote,butcan,tdrink.);.&JavaScript一if(variable-l=bananas)(variable_l=JavaScript)document,writein(,zThemonkeyishappybecauseithas+variable_l);.if-then.!2
13、: .?3:4: ,.6.:if-then.7.:if-then.B.:if-hen.9.1.10.:r.11.:z2.12.:8.:if-thenExercise.Thau!广.1,.2.:.4.:.5.:.6.:if-then.7.:if-then.8.:if-then.9.:.10.:.11,:.2.12.:r.Tha!JavaScriptonClick,一OnMoUSeoVer._.onClick.onMouseOver.JavaScripts-JavaScripts-JavaScripts-OnClick-Clickonme!-OnCIiCk二JavaScriptsalert_JIr
14、ef=_Mouseoverme!.OnMouseOver.onClick.2.:r.4.:.S:.6.:if-then.7.:if-hen.B.:if-then.9.:.10.:r.11.:/.12.:.10.:.Thau!OneofthemostcommonlyusedfeaturesofJavaScriptistheabilitytochangeimagesonamouseover.Unfortunately,MicrosoftInternetExplorer3.0doesnotsupportimagereplacement.SoifyoureusingIE3.Ozitmightbetim
15、etoupgradetoIE4.0orswitchtoNetscape.JavaScripts-.IE3.0-IE4.0.Netscape3.0.1.etsgothroughtheexamplestepbystep.ThefirstlineofinterestisThisisjustlikeaStandardexceptthisonehasbeengivenaname:Thisnamecouldbeanything:my_image,a_boxzwhatever-butitcanthaveanyspacesinit.the_image.my_image,a_boxz.Thenextlineof
16、interestischangeThisiswheretheimageswaphappens.Itsjustliketheousawbefore.TheactivepieceofJavaScript,whichappearsinthequotesoftheisthis:OnMouseOver.onMouseOver.JavaScript.document.thejmage.src=,button-d.gif,;ThisstatementsayszfindtheimagecalledandchangeitstoNotethattherearedoublequotesaroundthewholes
17、tatement,andtakessinglequotes.Althoughquotesareinterchangable,ifyouhaveonesetofquotesinsideanothersetofquotes,thesetshavetobeofdifferentkinds.SoyoucouldeitherdobutnotGotit?Jthe-image,.src.button_d.gif._竺Utton_d.gif_.something.something,.,something,orsomething,1.Justastherewasalotofdetailinwhatmakesd
18、ocument,writein()work,mnottellingyouexactlyhowthisimageswapisworking.Youlllearnthedetailsofbothwhenwelookatobject-orientedprogrammingandtheDocumentObjectModelinthenextlesson.document,writein().Animportantcaveataboutimageswappingisthattheimageyoureswitchingtoshouldbethesamesizeastheoriginal.Ifitsnot,
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- JavaScript教程 解释型或即时编译型的编程语言 JavaScript 教程 解释 即时 编译 编程 语言
链接地址:https://www.desk33.com/p-1415058.html