java script
What is JavaScript?
JavaScript is the programming language
Can write code to (web page-mobile application-games-security hacking
Why Study JavaScript?
JavaScript is one of the 3 languages all web developers must learn:
1. HTML to define the content of web pages
2. CSS to specify the layout of web pages
3. JavaScript to program the behavior of web pages
Note
The java script commands and instructions is called statements.
Java script statements are written in HTML codes.
Java script statements are written between tags <script>…</script>.
Each java script statement should be ended with the sign ;
Put in mind the status of letters capital or small when writing java script.
You can write the java script statements between </head>…</head>
Or </body>…</body>
1- alert () statement
alert() statement used for displaying a message via a dialogue box.
alert("the message");
Create a webpage that displays a dialogue box with message "welcome" on loading
<body>
<script>
alert("welcome");
</script>
</body>
2- Document .write(…) statement.
Document .write statement is used for displaying text within a webpage contents.
Create a webpage displays "computer and information technology subject" text as its content,
<body>
<script>
document .write("computer and information technology subject");
</script>
</body>
Now create JS page to insert java script code
[Link] and use code to link all page
Linked cod
1- <[Link]=”[Link]”></script> write in html page
2- Onload=function(){
} write on js page
Object: (properties-event (Methods) -procedure)
EX
<button
onclick="[Link]('myImage').src='pic_bulbon.gif'">Tur
n on the light</button>
<img id="myImage" src="pic_bulboff.gif" style="width:100px">
<button
onclick="[Link]('myImage').src='pic_bulboff.gif'">Tur
n off the light</button>