Mesran

Hanya ingin berbagi kebaikan dan mendapatkan kebaikan yang lain.

Pemakaian IF di Javascript

Pengolahan data tidak terlepas dari fungsi IF.

Berikut contoh program menggunakan fungsi IF pada Javascript

Nama program : if.html

<script type="text/javascript">
	function CekKeterangan(n){
		var ket="" ;
		if ( n>=60) {
			ket = "Lulus" ;
		}else{
			ket = "Gagal" ;
		}
		return (ket) ;
	}
</script>

<body>
	<form id="form1" name="prima">
 		<p>Cek Keterangan Ujian Mahasiswa</p>

 		<p>Nilai Ujian
 		  <input type="text" id="nilai" name="nilai" onKeyUp="document.prima.txt.value=CekKeterangan(parseFloat(document.prima.nilai.value))">
	  </p>
 		<p>Keterangan : <input type="text" id="txt" onFocus="blur()">
 	</form>
</body>

Hasilnya seperti berikut ini

Artikel Terbaru


About these ads

Filed under: Javascript,

10 Responses

  1. … [Trackback]…

    [...] Read More Infos here: mesran.wordpress.com/2012/01/09/pemakaian-if-di-javascript/ [...]…

  2. Open Office says:

    … [Trackback]…

    [...] Find More Informations here: mesran.wordpress.com/2012/01/09/pemakaian-if-di-javascript/ [...]…

  3. Walks says:

    … [Trackback]…

    [...] There you will find 62746 more Infos: mesran.wordpress.com/2012/01/09/pemakaian-if-di-javascript/ [...]…

  4. … [Trackback]…

    [...] There you will find 66598 more Infos: mesran.wordpress.com/2012/01/09/pemakaian-if-di-javascript/ [...]…

  5. …Awesome website…

    [...]Magnificent activity![...]…

  6. …Trackback: More Informations on that topic…

    [...]I have a presentation next week, and I am at the look for such information.[...]…

  7. Pemakaian IF di Javascript…

    [...]Thanks for some other fantastic post.[...]…

  8. My Homepage says:

    … [Trackback]…

    [...] Read More: mesran.wordpress.com/2012/01/09/pemakaian-if-di-javascript/ [...]…

  9. Anie says:

    Coba dr dulu bpk buat ini.. pasti mahasiswa nya (termasuk aku) lebih mncintai si programm… :( :(

Terima kasih telah memberikan komentar anda.

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Archives Per Tahun

Follow

Get every new post delivered to your Inbox.

Join 218 other followers

%d bloggers like this: