Intro to Javascript



Download 0,61 Mb.
bet2/7
Sana17.03.2023
Hajmi0,61 Mb.
#919991
1   2   3   4   5   6   7
Bog'liq
13-IntroJavascript

JavaScript vs. PHP

  • similarities:
    • both are interpreted, not compiled
    • both are relaxed about syntax, rules, and types
    • both are case-sensitive
    • both have built-in regular expressions for powerful text processing

JavaScript vs. PHP

  • differences:
    • JS is more object-oriented: noun.verb(), less procedural: verb(noun)
    • JS focuses on user interfaces and interacting with a document; PHP is geared toward HTML output and file/form processing
    • JS code runs on the client's browser; PHP code runs on the web server

JS <3

Linking to a JavaScript file: script

  • script tag should be placed in HTML page's head
  • script code is stored in a separate .js file
  • JS code can be placed directly in the HTML file's body or head (like CSS)

HTML

Event-driven programming

  • split breaks apart a string into an array using a delimiter
    • can also be used with regular expressions (seen later)
  • join merges an array into a single string, placing a delimiter between them

A JavaScript statement: alert

  • a JS command that pops up a dialog box with a message

alert("IE6 detected. Suck-mode enabled."); JS

Event-driven programming

  • you are used to programs start with a main method (or implicit main like in PHP)
  • JavaScript programs instead wait for user actions called events and respond to them
  • event-driven programming: writing programs driven by user events
  • Let's write a page with a clickable button that pops up a "Hello, World" window...

Buttons

  • button's text appears inside tag; can also contain images
  • To make a responsive button or other UI control:
    • choose the control (e.g. button) and event (e.g. mouse 1. click) of interest
    • write a JavaScript function to run when the event occurs
    • attach the function to the event on the control

HTML

Download 0,61 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish