<em>Ampersands & angle brackets need to be encoded.</em><HTML>
<HEAD>
<TITLE> Type Bilangan</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var a = 15;
b = 14;
tambah = a+b;
kali = a*b;
document.write("penambahan (" +a+"+"+b+") = " + tambah);
document.write("<BR>");
document.write("perkalian(" +a+"x"+b+") = " + kali );
document.write("<BR>");
//-->
</SCRIPT>
</BODY>
</HTML>
latihan 2
<HTML>
<HEAD>
<TITLE> konversi antar sistem bilangan</TITLE>
</HEAD>
<BODY bgcolor=green>
<SCRIPT LANGUAGE = "JavaScript">
<!--
var bil = new Number(25);
document.write("bilangan desimal: "+bil + "<BR>");
document.write(""<HR>"");
document.write("Biner: " + bil. toString(2) + "<BR>");
document.write("oktal : " + bil. toString(8) + "<BR>");
document.write("Heksa : " + bil.toString (16) + "<BR>");
//-->
</SCRIPT>
</BODY>
</HTML>
Tidak ada komentar:
Posting Komentar