Javascript
Upcoming SlideShare
Loading in...5
×

Like this? Share it with your network

Share
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
No Downloads

Views

Total Views
827
On Slideshare
827
From Embeds
0
Number of Embeds
0

Actions

Shares
Downloads
28
Comments
0
Likes
1

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. Chanief Budi Setiawan, S.T. © 2012
  • 2.
  • 3.   
  • 4.  document.write("<p>This is a paragraph</p>");  x=document.getElementById("demo") x.innerHTML="Hello";  <button type="button" onclick="myFunction()">Click Me!</button> 
  • 5. <script type="text/javascript"> //--your code here </script> <script type="text/javascript"> <!-- //--your code here --> </script>
  • 6.  // one line comments  /* this is a multiline comment. Its useful for longer comments and also to block out segments of code when you’re testing */  alert("Hello me");
  • 7.    
  • 8.   <script type="text/JavaScript"> alert( 'Third script Block '); function doSomething(){ alert( 'Function in Third script Block '); } // Call the function doSomething doSomething(); </script>
  • 9.   
  • 10.  
  • 11. <!-- file: P10-1-Coba.html --> <html> <head> <title>P10-1: Belajar JavaScript</title> <script type="text/javascript"> <!-- alert("Selamat Datang di PAW Lanjut") --> </script> </head> <body> Belajar menulis JavaScript </body> </html>
  • 12.  
  • 13. <!-- file: P10-2-Write.html --> <html> <head> <title>P10-2: Belajar JavaScript</title> </head> <body> Belajar menulis JavaScript<br> <script type="text/javascript"> <!-- document.write("<b>JavaScript</b> dapat ditulis"); document.write(" dalam tag <u>head</u> maupun <u>body</u><br>"); --> </script> Semua <i>browser</i> modern dapat menjalankan JavaScript </body> </html>
  • 14.    
  • 15. <!-- file: P10-3-PopUp.html --> <html> <head> <title>P10-3: PopUp Box JavaScript</title> <script type="text/javascript"> function CobaAlert() { alert("Pengembangan Aplikasi Web Lanjut"); } function CobaConfirm() { var jawaban = confirm("Anda sudah belajar ?"); if (jawaban == 1) { // Jika memilih OK alert("Anda jawab Ya."); } else{ // Jika memilih Cancel alert("Anda jawab Tidak."); } }
  • 16. function CobaPrompt() { var nama = prompt("Siapa nama Anda ?", ""); alert ("Selamat datang, " + nama); } </script> </head> <body> <input type="button" onclick="CobaAlert()" value="Alert" /> <input type="button" onclick="CobaConfirm()" value="Confirm" /> <input type="button" onclick="CobaPrompt()" value="Prompt" /> </body> </html>
  • 17.
  • 18. <!-- file: P10-4-Aritmetika.html --> <html> <head> <title>P10-4: Aritmetika JavaScript</title> </head> <body> <script type="text/javascript"> bil1 = 12; bil2 = 13; hasil = bil1 + bil2; document.write( bil1 + " ditambah " + bil2 + " sama dengan " + hasil ); </script> </body> </html>
  • 19.      
  • 20.  function PerkalianAngka () { bil1 = prompt("Angkanya ialah bla bla", ""); bil2 = prompt("Angkanya ialah bla bla", ""); hasil = bil1 * bil2; alert (" bla bla bla "); } 