ウェブ学のすすめ

Study of Web Design & Programing

標準体重計算プログラム

プレビュー
PC版

標準体重計算プログラム - jsdo.it - share JavaScript, HTML5 and CSS


スマホ版

標準体重計算プログラム - js do it

コード

<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>標準体重</title>
</head>
<body>
<script type="text/javascript">
var height;
var weight;

height = prompt('身長を入力してください',170);

height = parseInt(height);

weight = (height - 100)*0.9;

document.write('<h1>');
document.write('身長が',height,'cmの人の標準体重は');
document.write(weight,'kgです。');
document.write('<\/h1>');
</script>
</body>
</html>