صفحه 1:
آشنايى با بمج )رول
زبانی شی گرا ساخته شرکت «ممسحبه()
مستقل از محیط اجر ا(متاهام-حجسس)
انواع ومح 8)سمول:
(chect-sice) 21S Cres —
(server-side eA Cras —
مورد استفاده:
برای ساخت صفحات پویا(عس)
صفحه 2:
weve rript آشنایی با
‘CLIENT-SIDE JAVASCRIPT
صفحه 3:
آشنایی با از (i ava
substitute, guess, word, anewer) 1 مغ
var resule = "";
Var pes = OF
while( pos < Jen) {
یقت وه دور poms momen ales
var Gnewar char - snewer.substring( pos, poe + 1);
Le" Cnord cher == guess | yesult 2 resule’s guess
مه Tesult = result + anewarchar;
0
رعلند نطو
1
12 بصعم وصقط
Web tite
(bytecode
executable)
JavaScript
application
SHINE» <HEAD> <TITLE> Hangman </TITLE></HEAD> یی
ا دلوت </i>
12) Client gamene
client. gameno = 1
clisnt wnowgame = "true"
nual) (
>
</ SERVER
Youlhave used the following lettere so far
SSERVERowrite (lient-used) </SERVER>
1 ACTrom- "hangman. htm" >
What is your guess?
<jSony></atm>
صفحه 4:
آشنايى با دمص )ره لردمم
صفحه 5:
مقایسه من مرول با مرول
Java
Compiled bytecodes downloaded from
server, executed on client.
Class-basedl, Objects are divided into
classes and instances with all inheritance
through the class hierarchy. Classes and
instances cannot have properties or
methods added dynamically
Applets distinct from HTML (accessed
from HTML pages)
Variable data types must be declared
(static typing).
Cannot automatically write to hard disk.
JavaScript
Interpreted (not compiled) by client
Object-oriented. No distinction between
types of objects. Inheritance is through
the prototype mechanism, and properties,
and methods can be added to any object
dynamically
Code integrated with, and embedded in,
HTML
Variable data types not declared
(dynamic typing).
Cannot automatically write to hard disk,
صفحه 6:
كار كردن با اشیاء در 6
٠ مشخصه هاى («وصاسومم م) شى
جدون ( لج درصصح. جدون (1دجتواد
"لسوت" تجد اوجن .سو 0) ريه ]و
او ester” ]ون
9 9
صفحه 7:
کار کردن با اشیاء در )لس
۰ ایجاد شی جدید
- استفاده از Objet “loitcizers:
sbeok Dene = {properAlinke, propery inke®,..., propery DirkeD}
- استفاده از تابع سازنده(مسصاعسی):
صفحه 8:
كار كردن با اشیاء در iss IG
صفحه 9:
اشیاء از پیش تعریف شده
Ora Objet (son, reverse, «..)
uth Objevt (Boor, obs, rand, ...)
Gtricny Objert (chart, subsir, raat, ...)
صفحه 10:
قرار دادن )ل در صفحات ,اوررر
۶ قرار دادن کد در بدنه صفحه
۶ استفاده از فایل های ,حو(مناسب برای به اشترلک گذاری کد)
۶ هل به عنولنمقادیر attribute ها
صفحه 11:
نحوه پاسخ گویی به یک رخداد در 6ل
* تعریف کلی:
<صل<) بو مرول امه اوه )>
٠ مثال:
<"(وموخاجها) دجم "ححام امج PY CES"butioa" OBLOC="Carukate" :11/()ذ)(10>
"سسست 006۵0 "سس ۵ ۵۵-00 10۵/۳۷ >
۲( لوط اکن
صفحه 12:
Radio
‘Checkbox
Plugin
Form
Hastory
تسج
۳
FileUpload |
Password ]
Layer
Link ]
سلسله مراتب اشياء در UG
صفحه 13:
Property
Summary لوسرو Description
action Reflects the ACTION attibue
elementa ‘An array reflecting all the elements in a form,
encoding Reflects the BNCTYPE attribute,
Length Reflects the numberof elements om a form
method Reflects the METHOD attribute
ane Reflects the NANE attribute
مومت Reflects the TARGET sttibuce
Method Summary
Method Desenption
handi event Invokes the handler forthe specified event
reset Sirmulates-a mouse click on a reset button forthe calling form.
submit, Submits a form.
صفحه 14:
صفحه 15:
زبان های مبتنی بر كلاس و مبتتی بر شی
Prototype-based (JavaScript)
All objects are instances,
Define and create a set of objects with constructor
Junctions.
Same.
Construct an object hierarchy by assigning an object
as the prototype associated with a constructor
function.
Inherit properties by following the prototype chain.
initial
Constructor function or prototype specifies 4
set of properties, Can add or remove properties
dynamically 10 individual objects or to the entire set
of objects.
Class-based (Java)
Class and instance are distinct entities.
Define a class with a class definition; instantiate a
class with constructor methods.
Create a single object with the new operator.
Construct an object hierarchy by using class
definitions to define subclasses of existing classes.
Inherit properties by following the class chain.
Class definition specifies all properties ofall
instances of a class. Cannot add properties
dynamically at runtime.
صفحه 16:
زبان های مبتنی بر کلاس و مبتنی بر شی(دمم
= os
Manager
صفحه 17:
زبان های مبتنی بر کلاس و مبتنی بر شی(دمم
Object hierarchy
Individual objects
jim = new Employes
jim.name i
jimedept
‘general”
sally — new Manager
sally.name is"
sally.dept Is "general"
sallyreports is [ ]
mark - new WorkerBeo
mark-name is"
mark.dept is
mark projects is []
fred - new SalesPerson
fred.name is
fred.dept is "sales"
fred.projects is []
fred.quota كا 100
jane = new Engineer
Jane-name is
Jane.depe is “engineering”
Jane projects is [ ]
Janemachine وا
WorkerBee ۱
SalesPerson ۱ Engineer ۱
Manager ۱
صفحه 18:
‘Event handler
onAbort
ouBlur
‘onChange
onClick
onDragDrop
رخدادها در UG
‘Occurs when
User aborts the loading
of an image (for
example by clicking a
link or clicking the
Stop button)
‘User removes input focus
from window or
form element
User changes value of
element
User clicks form element
or link
User drops an object onto
the browser
window, such as
dropping a file on the
browser window
‘Applies to
images
windows and all form
clements
text fields, textareas, select
lists
‘buttons, radio buttons,
checkboxes, submit
buttons, reset buttons,
links
windows
Event
‘Abort
Blur
Change
Click
DragDrop
صفحه 19:
Event handler
onError
onFocus
onKeyDown
onKeyPress
ouKeyUp
onload
onMouseDown
onMouseMove
a IG رخدادها در
Occurs when
The loading ofa
document or image
causes an error
User gives input focus to
window or form
element
User depresses a key
User presses or holds
down a key
User releases a key
User loads the page in
the Navigator
‘User depresses a mouse
button
User moves the cursor
Applies to
images, windows
windows and all form
elements
documents, images, links,
text areas
documents, images, links,
text areas
documents, images, links,
text areas
document body
documents, buttons, links
nothing by default
Event
Error
Focus
KeyDown
KeyPress
KeyUp
Toad
MouseDown
MouseMove
صفحه 20:
Event handler
onMouseOut
onMouseOver
onMouseUp
onMove
onReset
onResize
onSelect
onSubmit
onUnload
a IG رخدادها در
Occurs when
‘User moves cursor out of
a client-side
image map or link
User moves cursor over a
link
User releases a mouse
button
‘User or seript moves a
window
‘User resets a form (clicks
a Reset button)
‘User or seript resizes a
window
User selects form
element’s input field
User submits a form
User exits the page
Applies to
areas, links
Tinks
documents, buttons, links
windows
forms
windows
text fields, textareas
forms
document body
Event
‘MouseOut
MouseOver
MouseUp
Move
Reset
Resize
Select
Submit
Unload