6c4440524ccb99122e84058ce9e65d75.ppt
- Количество слайдов: 117
XP Java. Script • • • Source from multiple external sources from the Internet over the years Please PM me to claim credit if needed Known Arthur: John Mitchell (2008), Tom Horton, Alfred C Weaver, Richard Sinn 1
XP Java. Script History o Developed by Brendan Eich at Netscape n Scripting language for Navigator 2 o Later standardized for browser compatibility n ECMAScript Edition 3 (aka Java. Script 1. 5) o Related to Java in name only n Name was part of a marketing deal o Various implementations available n Spidermonkey interactive shell interface n Rhino: http: //www. mozilla. org/rhino/
XP HTML Background o Many “markup” languages in the past o SGML: Standard Generalized Markup Language n HTML (Hypertext Markup Language) based on SGML o XML (e. Xtensible Markup Language) “replaces” SGML n XHTML is replacing HTML 3
XP Principles o Distinguish structure from presentation n Presentation based on structure n Presentation may vary, perhaps based on display characteristics, user-preference, etc. o People like to ignore this idea n E. g. use vs. n tag? o XML and CSS or XSL 4
XP 5
XP Tags and Elements o Example of an element:
XP Basic HTML Structure o Comments: o Example:
… …. <--- title, metatags, etc. (not displayed) <--- main content (displayed) 7XP Larger Example
An Example
Hello World!
I am 21.
- Green
- Yellow
- John
- Mike
XP Displays As… 9
XP Basic Tags o Text display: n , , o Structure: n n ,
,
o Attributes: n Align, text, bgcolor, etc. 10
XP Basic Tags (2) o Links: … o Images: n an empty tag o Tables n Use an editor! o Forms: later 11
XP More HTML o Learn on your own o You may never code in “raw” HTML o You may need to tweak HTML files created by a tool o You will need to understand HTML to code in Java. Script etc. o You will need to understand HTML to know limitations on how docs on the web can be structured 12
XP Document Object Model (DOM) o An model for describing HTML documents (and XML documents) n A standard (ok, standards) n Independent of browser, language o (ok, mostly) n A common set of properties/methods to access everything in a web document o APIs in Java. Script, for Java, etc. 13
XP DOM o You get anything you want from… o More info: http: //en. wikipedia. org/wiki/Document_O 14 bject_Model
document. write('This is" src="https://present5.com/presentation/6c4440524ccb99122e84058ce9e65d75/image-15.jpg" alt="XP Java. Script Statements
document. write('
My Page My Page XP Java. Script Statements
window. prompt('Enter your Another event name: ', '');" src="https://present5.com/presentation/6c4440524ccb99122e84058ce9e65d75/image-18.jpg" alt="XP Example Statements
XP HTML Forms and Java. Script o Java. Script is very good at processing user input in the web browser o HTML
Name: Phone: " src="https://present5.com/presentation/6c4440524ccb99122e84058ce9e65d75/image-20.jpg" alt="XP Naming Form Elements in HTML
XP Forms and Java. Script document. formname. elementname. value Thus: document. addressform. yourname. value document. addressform. phone. value document. addressform. email. value
Enter your name: Enter your name: XP Using Form Data Personalising an alert box
XP Tips o Check your statements are on one line o Check your " and ' quotes match o Take care with capitalisation o Lay it out neatly - use tabs o Remember in the workbook denotes a continuing line o Be patient esentation slides adapted from scom. hud. ac. uk/scomsjw/Web%20 Authoring%20 Module/Lecture%20 Slides/introjs. ppt
XP W 3 C Standards o o o XML, XHTML CSS, XSLT DOM ECMAScript etc 24
XP Java. Script o An example of a “scripting” langauge that is embedded in HTML documents n The browser’s display engine must distinguish from HTML and Script statements o Others like this: n PHP (later in the course) 25
XP History o Java. Script created by Netscape o JScript created by Microsoft o IE and Netscape renderings are slightly different o Standardized by European Computer Manufacturers Association (ECMA) o http: //www. ecma-international. org/publications /standards/Ecma-262. htm 26
XP General Format n n n n