2076 Posts in 483 Topics- by 820 Members - Latest Member: akunp2

Pages: [1]   Go Down
  Print  
Author Topic: [Javascript] Circum Functions  (Read 1079 times)
webmaster
Administrator
phpBB Guru
*****
Offline Offline

Posts: 924


hairulazami
View Profile WWW
« on: December 10, 2007, 11:29:12 PM »

Bwat yang mao belajar matematika, ni dia sample Javascript na, cara ngitung volume:

di bagian <HEAD>:

Code:
function circum() {
var radius = prompt("Enter the radius of the circle","");
var circle = 2 * Math.PI * radius;
alert("The circumference is "+circle)
}

tros di <BODY> na kasii ke gini:

Code:
<form>
<input type="button" value="Calculate the circumference" onclick="circum()">
</form>

jadi lengkap na ke gini brother :

Code:
<html>
<head>
<title>Circum Functions</title>

<script>
function circum() {
var radius = prompt("Enter the radius of the circle","");
var circle = 2 * Math.PI * radius;
alert("The circumference is "+circle)
}
</script>
</head>
<body>
<form>
<input type="button" value="Calculate the circumference" onclick="circum()">
</form>
</body>
</html>


Klik di sini bwat liat hasilna:

http://www.dremi.info/web/tips/circum.html

Coba yak !!!  :lachtot:  Cheesy  :)
« Last Edit: January 01, 1970, 07:00:00 AM by webmaster » Logged


Pages: [1]   Go Up
  Print  
 
Jump to: