- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
JavascriptJscriptCh 7,8,9,10.ppt
Javascript/JscriptCh 7,8,9,10 Introduction Basics Syntax for invoking methods in the object object.method “string”, “[additional arguments]” ; document.writeln “ argument ” ; C like syntax Uses the writeln method in the browser’s document object … tag: Encloses entire script Attribute LANGUAGE “JavaScript” Document Object Window Object Windows, Documents and String handling Windows, Documents and String handling Output JavaScript is Loosely Typed Math Object Compound Interest Script Output Switch Statement Switch Statement Switch Script Output A Game of Chance - “CRAPS” Rules of “craps” Player rolls 2 dice 6 faces/die, range: 1-6 Sum of spots on two upward faces calculate If sum equals 7 or 11 – player wins ? If sum equals 2, 3 or 12 on first throw called “craps” – player loses ? If sum equals 4, 5, 6, 8, 9 or 10 on first throw – sum is players “point” If game not over after first roll, player continues rolling If rolls sum equal to his “point” – player wins ? if rolls 7 before matching his “point” – player loses ? Player continues rolling until game is over Input from Forms Program can receive input from user through forms GUI Form Setup using Form: GUI is enclosed inside an HTML Form FORM NAME “formName” … tags Every GUI output is defined with the INPUT element INPUT NAME “inputName” TYPE “text” Enter as many tags as needed Form Event Handling Clicking on GUI button element causes an action INPUT TYPE “button” VALUE “buttonLabel” ONCLICK “javaScriptFunctionName” Function indicated is executed when button clicked Any user interaction with a GUI is called an event Event handling – JavaScript execution in response to an event GUI’s are located in the BODY of the HTML document Form Data output Program can output results to a form Within a function, write a statement in the following format: formName.InputName.value Value to be output; Outputing results to the Browser Status Bar Print text by typing window.status “text to be p
您可能关注的文档
- Cl2 + H2O =HCl + HClO.ppt
- Class 4Applying Loads to Buildings.ppt
- Class 7 (Ch. 8 & 9).ppt
- Class 9 Thurs., Oct. 7.ppt
- Classroom Presenter Demo.ppt
- Click to type slide title.ppt
- climb 爬.ppt
- CLINICAL CHEMISTRYCHAPTER 9.ppt
- Clinical Diagnostics.ppt
- CM 197Mechanics of MaterialsChap 8 Moments of Inertia.ppt
- JDOS Openstack+Docker.ppt
- Jianhu Foreign Language School By Yang Cheng.ppt
- Jim LiuJanuary 28, 2003.ppt
- JINTEX CORPORATION LTD..ppt
- jiāo 骄.ppt
- John Keats & Ode on a Grecian Urn.ppt
- Johns Hopkins CPC#4.ppt
- Joinwork v2.0.ppt
- Ju Teng International Holdings Limited.ppt
- ju3tian2wai1zheng4 bu4 gao4 su4 bei4 shan1 xiang4.ppt
文档评论(0)