دسته بندی کدهای آماده برای محاسبه گرها
محاسبه محیط یک دایره، بر اساس شعاع آن (با javascript)
این کد برای محاسبه محیط دایره، بر اساس مقدار شعاع دایره، به کار می رود :
کدها :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript">
function calculate() {
var radius=prompt("Please enter the size of the radius","");
var pi=3.14159265359; // estimated to 11 decimal places
var circ=2*pi*radius;
var d=alert("The circumference of a circle with radius "+radius+" is "+circ+".")
}
</script>
</head>
<body>
<form>
<input type="button" value="Calculate Circumference" onClick="calculate()">
</form>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script language="JavaScript">
function calculate() {
var radius=prompt("Please enter the size of the radius","");
var pi=3.14159265359; // estimated to 11 decimal places
var circ=2*pi*radius;
var d=alert("The circumference of a circle with radius "+radius+" is "+circ+".")
}
</script>
</head>
<body>
<form>
<input type="button" value="Calculate Circumference" onClick="calculate()">
</form>
</body>
</html>
دسته بندی کدهای آماده برای محاسبه گرها
نظرات 0 0 0