PESAN PROMPT
PESAN CONFIRM
Menampilkan pesan ALERT
Menulis Teks
Membuka lebih dari satu Tab Windows
FUNGSI TIMER
MENAMPILKAN GAMBAR DI BLOG
All Teks Menjadi Hyperlink Secara Otomatis
Fungsi Teks & Button
Pemakaian alert sebagai property window
Pemakaian metode dalam objek
Pemakaian prompt
Pembuatan fungsi dan cara pemanggilannya
Operasi dasar aritmatika
Operasi relational
Seleksi kondisi (if..else)
Penggunaan operator switch untuk seleksi kondisiPemakaian looping < for >
Pemakaian looping < do..while > Pemakaian looping < while >
Membuat link popup window di browser dengan javascript
KODE UNTUK MEMBERI EFEK TAMPILAN
Membuat link popup window di browser dengan javascript
KODE UNTUK MEMBERI EFEK TAMPILAN
KODE UNTUK MELIHAT PASSWORD YANG KITA MASUKKAN
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function test ()
{
val1=window.prompt("Input Nilai (1-5):")
switch (val1)
{
case "1" :
document.write("bilangan satu")
break
case "2" :
document.write("bilangan dua")
break
case "3" :
document.write("bilangan tiga")
break
case "4" :
document.write("bilangan empat")
break
case "5" :
document.write("bilangan lima")
break
default :
document.write("bilangan lainnya")
}
}
</SCRIPT>
<BODY>
<input type="button" name="button1" value="switch"
onclick=test()>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
PESAN PROMPT
<SCRIPT LANGUAGE="JavaScript">
Hasil=window.prompt ("Masukkan nama Anda?");
document.write ("Nama Anda adalah : " + Hasil);
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
Hasil=window.prompt ("Masukkan nama Anda?");
document.write ("Nama Anda adalah : " + Hasil);
</SCRIPT>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
PESAN CONFIRM
<SCRIPT LANGUAGE="JavaScript">
Hasil=window.confirm ("Apakah web ini keren???") ;
if (Hasil==true)
document.write ("Anda menjawab Ya");
else
document.write ("Anda menjawab Tidak");
</SCRIPT>
Hasil=window.confirm ("Apakah web ini keren???") ;
if (Hasil==true)
document.write ("Anda menjawab Ya");
else
document.write ("Anda menjawab Tidak");
</SCRIPT>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Menampilkan pesan ALERT
<SCRIPT LANGUAGE="JavaScript">
window.alert ("Anda memasuki sebuah web keren");
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
window.alert ("Anda memasuki sebuah web keren");
</SCRIPT>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Menulis Teks
document.write(“Percobaan”);
document.writeln(“Percobaan”);
document.write(“Percobaan”);
document.writeln(“Percobaan”);
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Membuka lebih dari satu Tab Windows
<script type="text/javascript">
function open_win() {
window.open("http://a.easyhits4u.com/splash1.php?ref=eightstein");
window.open("http://www.easyhits4u.com/splash.php?ref=eightstein");
window.open("http://galerigila.blogspot.com");
}
</script>
<a href="javascript: void(0)" onclick="open_win()">TIPS BLOGGER</a>
<script type="text/javascript">
function open_win() {
window.open("http://a.easyhits4u.com/splash1.php?ref=eightstein");
window.open("http://www.easyhits4u.com/splash.php?ref=eightstein");
window.open("http://galerigila.blogspot.com");
}
</script>
<a href="javascript: void(0)" onclick="open_win()">TIPS BLOGGER</a>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
FUNGSI TIMER
<SCRIPT LANGUAGE = "JavaScript">
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000
function InitializeTimer()
{
// Set the length of the timer, in seconds
secs = 10
StopTheClock()
StartTheTimer()
}
function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function StartTheTimer()
{
if (secs==0)
{
StopTheClock()
alert("You have just wasted 10 seconds of your life.")
}
else
{
self.status = secs
secs = secs - 1
timerRunning = true
timerID = self.setTimeout("StartTheTimer()", delay)
}
}
//-->
secs = 10
onLoad=InitializeTimer()
</SCRIPT>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var secs
var timerID = null
var timerRunning = false
var delay = 1000
function InitializeTimer()
{
// Set the length of the timer, in seconds
secs = 10
StopTheClock()
StartTheTimer()
}
function StopTheClock()
{
if(timerRunning)
clearTimeout(timerID)
timerRunning = false
}
function StartTheTimer()
{
if (secs==0)
{
StopTheClock()
alert("You have just wasted 10 seconds of your life.")
}
else
{
self.status = secs
secs = secs - 1
timerRunning = true
timerID = self.setTimeout("StartTheTimer()", delay)
}
}
//-->
secs = 10
onLoad=InitializeTimer()
</SCRIPT>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
MENAMPILKAN GAMBAR DI BLOG
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwFokhGVzXDnCnX-A6a-QUdM9qtCzGH2No427Lt9-4nggzIqXfzoodRoDxroUI32w1qWq3wBZyA-083Sv4vBR6d7vsjFHhWWW_sH2W44FpH7kchnph06P-d8YppUYA3-Vm3CA8n-4_TN0/s1600/Investasi+Emas+Sekarang+Juga.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="484" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwFokhGVzXDnCnX-A6a-QUdM9qtCzGH2No427Lt9-4nggzIqXfzoodRoDxroUI32w1qWq3wBZyA-083Sv4vBR6d7vsjFHhWWW_sH2W44FpH7kchnph06P-d8YppUYA3-Vm3CA8n-4_TN0/s640/Investasi+Emas+Sekarang+Juga.jpg" width="640" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwFokhGVzXDnCnX-A6a-QUdM9qtCzGH2No427Lt9-4nggzIqXfzoodRoDxroUI32w1qWq3wBZyA-083Sv4vBR6d7vsjFHhWWW_sH2W44FpH7kchnph06P-d8YppUYA3-Vm3CA8n-4_TN0/s1600/Investasi+Emas+Sekarang+Juga.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"><img border="0" height="484" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgwFokhGVzXDnCnX-A6a-QUdM9qtCzGH2No427Lt9-4nggzIqXfzoodRoDxroUI32w1qWq3wBZyA-083Sv4vBR6d7vsjFHhWWW_sH2W44FpH7kchnph06P-d8YppUYA3-Vm3CA8n-4_TN0/s640/Investasi+Emas+Sekarang+Juga.jpg" width="640" /></a></div>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
All Teks Menjadi Hyperlink Secara Otomatis
<script type="Text/javascript">
function open_win(){
window.open("http://adf.ly/4RxXb");
}
</script>
<a href="javascript.void(0)"onclick="open_win()"tes</a>
Resep Alami Mengobati Typhus Atau Tipes
<br><br>
Resep Pertama
Persiapkan 30 gram pegagan segar dan 30 gram patikan kebo segar, kamu cuci terlebih dahulu lalu rebus dengan air 600 cc sampai tersisa airnya sejumlah 300 cc, kemudian air rebusan tersebut diminum sebanyak 2 hingga 3 kali dalam sehari
<script type="Text/javascript">
function open_win(){
window.open("http://adf.ly/4RxXb");
}
</script>
<a href="javascript.void(0)"onclick="open_win()"tes</a>
Resep Alami Mengobati Typhus Atau Tipes
<br><br>
Resep Pertama
Persiapkan 30 gram pegagan segar dan 30 gram patikan kebo segar, kamu cuci terlebih dahulu lalu rebus dengan air 600 cc sampai tersisa airnya sejumlah 300 cc, kemudian air rebusan tersebut diminum sebanyak 2 hingga 3 kali dalam sehari
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Fungsi Teks & Button
<input name="tx" id="tx" type="text" value="xtx">
<INPUT TYPE = "BUTTON" VALUE = "Teks Kuning" onClick = tx.value="tes">
<INPUT TYPE = "BUTTON" VALUE = "Teks Kuning" onClick = tx.value=tx.value+"tes">
<input name="tx" id="tx" type="text" value="xtx">
<INPUT TYPE = "BUTTON" VALUE = "Teks Kuning" onClick = tx.value="tes">
<INPUT TYPE = "BUTTON" VALUE = "Teks Kuning" onClick = tx.value=tx.value+"tes">
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Pemakaian alert sebagai property window
<HTML>
<HEAD>
<TITLE>Alert Box</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
<!--
window.alert("Ini merupakan pesan untuk Anda");
//-->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Alert Box</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
<!--
window.alert("Ini merupakan pesan untuk Anda");
//-->
</SCRIPT>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Pemakaian metode dalam objek
<HTML>
<HEAD>
<TITLE>Skrip JavaScript</TITLE>
</HEAD>
<BODY>
Percobaan memakai JavaScript:<BR>
<SCRIPT LANGUAGE = "JavaScript">
<!--
document.write("Selamat Mencoba JavaScript<BR>");
document.write("Semoga sukses!");
//-->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Skrip JavaScript</TITLE>
</HEAD>
<BODY>
Percobaan memakai JavaScript:<BR>
<SCRIPT LANGUAGE = "JavaScript">
<!--
document.write("Selamat Mencoba JavaScript<BR>");
document.write("Semoga sukses!");
//-->
</SCRIPT>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Pemakaian prompt
<HTML>
<HEAD>
<TITLE>Pemasukan Data</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var nama = prompt("Siapa nama Anda?","Masukkan nama anda");
document.write("Hai, " + nama);
//-->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Pemasukan Data</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var nama = prompt("Siapa nama Anda?","Masukkan nama anda");
document.write("Hai, " + nama);
//-->
</SCRIPT>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Pembuatan fungsi dan cara pemanggilannya
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function pesan(){
alert ("memanggil javascript lewat body onload")
}
</SCRIPT>
<BODY onload=pesan()>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function pesan(){
alert ("memanggil javascript lewat body onload")
}
</SCRIPT>
<BODY onload=pesan()>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Operasi dasar aritmatika
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function test (val1,val2)
{
document.write("<br>"+"Perkalian : val1*val2 "+"<br>")
document.write(val1*val2)
document.write("<br>"+"Pembagian : val1/val2 "+"<br>")
document.write(val1/val2)
document.write("<br>"+"Penjumlahan : val1+val2 "+"<br>")
document.write(val1+val2)
document.write("<br>"+"Pengurangan : val1-val2 "+"<br>")
document.write(val1-val2)
document.write("<br>"+"Modulus : val1%val2 "+"<br>")
document.write(val1%val2)
}
</SCRIPT>
<BODY>
<input type="button" name="button1" value="arithmetic"
onclick=test(9,4)>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function test (val1,val2)
{
document.write("<br>"+"Perkalian : val1*val2 "+"<br>")
document.write(val1*val2)
document.write("<br>"+"Pembagian : val1/val2 "+"<br>")
document.write(val1/val2)
document.write("<br>"+"Penjumlahan : val1+val2 "+"<br>")
document.write(val1+val2)
document.write("<br>"+"Pengurangan : val1-val2 "+"<br>")
document.write(val1-val2)
document.write("<br>"+"Modulus : val1%val2 "+"<br>")
document.write(val1%val2)
}
</SCRIPT>
<BODY>
<input type="button" name="button1" value="arithmetic"
onclick=test(9,4)>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Operasi relational
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function test () {
val1=window.prompt("Nilai I :")
val2=window.prompt("Nilai II :")
document.write("<br>"+"val1==val2"+"<br>")
document.write(val1==val2)
document.write("<br>"+"val1!=val2"+"<br>")
document.write(val1!=val2)
document.write("<br>"+"val1>val2"+"<br>")
document.write(val1>val2)
document.write("<br>"+"val1<val2"+"<br>")
document.write(val1<val2) }
</SCRIPT>
<BODY>
<input type="button" name="button1" value="relational"
onclick=test()>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function test () {
val1=window.prompt("Nilai I :")
val2=window.prompt("Nilai II :")
document.write("<br>"+"val1==val2"+"<br>")
document.write(val1==val2)
document.write("<br>"+"val1!=val2"+"<br>")
document.write(val1!=val2)
document.write("<br>"+"val1>val2"+"<br>")
document.write(val1>val2)
document.write("<br>"+"val1<val2"+"<br>")
document.write(val1<val2) }
</SCRIPT>
<BODY>
<input type="button" name="button1" value="relational"
onclick=test()>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Seleksi kondisi (if..else)
<HTML>
<HEAD>
<TITLE>Contoh if-else</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var nilai = prompt("Nilai (0-100): ", 0);
var hasil = "";
if (nilai >= 60)
hasil = "Lulus";
else
hasil = "Tidak Lulus";
document.write("Hasil: " + hasil);
//-->
</SCRIPT>
</BODY>
</HTML>
<HTML>
<HEAD>
<TITLE>Contoh if-else</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var nilai = prompt("Nilai (0-100): ", 0);
var hasil = "";
if (nilai >= 60)
hasil = "Lulus";
else
hasil = "Tidak Lulus";
document.write("Hasil: " + hasil);
//-->
</SCRIPT>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Penggunaan operator switch untuk seleksi kondisi<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<SCRIPT language="Javascript">
function test ()
{
val1=window.prompt("Input Nilai (1-5):")
switch (val1)
{
case "1" :
document.write("bilangan satu")
break
case "2" :
document.write("bilangan dua")
break
case "3" :
document.write("bilangan tiga")
break
case "4" :
document.write("bilangan empat")
break
case "5" :
document.write("bilangan lima")
break
default :
document.write("bilangan lainnya")
}
}
</SCRIPT>
<BODY>
<input type="button" name="button1" value="switch"
onclick=test()>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
Pemakaian looping < for >
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<BODY>
<SCRIPT language="Javascript">
<!--
for (x=0;x<=10;x++)
document.write(x+"<br>")
// -->
</SCRIPT>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<BODY>
<SCRIPT language="Javascript">
<!--
for (x=0;x<=10;x++)
document.write(x+"<br>")
// -->
</SCRIPT>
</BODY>
</HTML>
Pemakaian looping < do..while >
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<BODY>
<SCRIPT language="Javascript">
<!--
var x=0
do{
document.write(x+"<br>")
x++;
}
while (x<=10)
// -->
</SCRIPT>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<BODY>
<SCRIPT language="Javascript">
<!--
var x=0
do{
document.write(x+"<br>")
x++;
}
while (x<=10)
// -->
</SCRIPT>
</BODY>
</HTML>
Pemakaian looping < while >
<HTML>
<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<BODY>
<SCRIPT language="Javascript">
<!--
var x=0
while (x<=10){
document.write(x+"<br>")
x++;
}
// -->
</SCRIPT>
</BODY>
</HTML>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA<HEAD>
<TITLE>Contoh Program Javascript</TITLE>
</HEAD>
<BODY>
<SCRIPT language="Javascript">
<!--
var x=0
while (x<=10){
document.write(x+"<br>")
x++;
}
// -->
</SCRIPT>
</BODY>
</HTML>
Membuat link popup window di browser dengan javascript
<script type="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=625,height=610,scrollbars=yes');
return false;
}
//-->
</script>
<center><a href="http://onlinetvamienk.com/streaming/livescore.html" onclick="return popup(this, 'notes')"><b>Live Score Sepakbola</b></a></center>
<script type="text/javascript">
<!--
function popup(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
href=mylink;
else
href=mylink.href;
window.open(href, windowname, 'width=625,height=610,scrollbars=yes');
return false;
}
//-->
</script>
<center><a href="http://onlinetvamienk.com/streaming/livescore.html" onclick="return popup(this, 'notes')"><b>Live Score Sepakbola</b></a></center>
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
KODE UNTUK MEMBERI EFEK TAMPILAN
javascript:R=0;
x1=.1; y1=.05; x2=.25; y2=.24; x3=1.6; y3=.24; x4=300; y4=200; x5=300;
y5=200; DI=document.getElementsByTagName("img"); DIL=DI.length; function
A(){for(i=0; i-DIL; i++){DIS=DI[ i ].style; DIS.position='absolute';
DIS.left=(Math.sin(R*x1+i*x2+x3)*x4+x5)+"px";
DIS.top=(Math.cos(R*y1+i*y2+y3)*y4+y5)+"px"}R++}
setInterval('A()',5); void(0);
- Untuk pemakaiannya misal buka dulu web:.
- Lalu copy kode itu di address bar,dan tekan enter:
Semua gambar di halaman tersebut akan berputar-putar
Untuk mengembalikannya tekan reload atau f5
setInterval('A()',5); void(0);
- Untuk pemakaiannya misal buka dulu web:.
- Lalu copy kode itu di address bar,dan tekan enter:
Semua gambar di halaman tersebut akan berputar-putar
Untuk mengembalikannya tekan reload atau f5
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA
KODE UNTUK MELIHAT PASSWORD YANG KITA MASUKKAN
javascript:(function(){var%20s,F,j,f,i;%20s%20=%20%22%22;%
20F%20=%20document.forms;
%20for(j=0;%20j<F.le
ngth;%
20++j)%20{%20f%20=%20F[j];%20for%20(i=0;%20i<f.length;%20++i)%20{%20if%20(f[i].type.toLowerCase()
%20==%20%22password%22)%20s%20+=%20f[i].value%20+%20%22\n%22;%20}%20}%20if%20(s)%20alert(%22Passwords%
20in%20forms%20on%20this
%20page:\n\n%22%20+%20s);%20else%20alert(%22There%20are
%20no%20saved%20passwords%20in%20for
ms%20on%20this%20page.%22);})();
- Untuk kerjanya misal kita buka kaskus
- Ketikkan nama dan password sembarang dulu buat percobaan
disini saya pake nama:saya dan password:passwordcoba
- Masukkan kode di addres bar lagi dan tekan enter:
tips:
minta temenmu isi nama dan password facebooknya, tapi jangan login
dulu, setelah itu baru anda copy-kan kode ini ke browsernya (Firefox)
GALERIGILA GALERIGILA GALERIGILA GALERIGILA GALERIGILA