このプログラムを作成して、ユーザーに2つの単語を入力させ、両方の単語を1行に出力しようとしています。行全体の長さが 30 になるように、単語は十分なドットで区切られます。これを試してみましたが、取得できないようです。
<html>
<head>
<title>Lenth of 30</title>
<script type="text/javascript">
//Program: Lenth of 30
//Purpose: The words will be separated by enough dots so that the total line length is 30:
//Date last modified: 4/11/12
var firstword = ""
var secondword = ""
firstword = prompt("Please enter the first word.")
secondword = prompt("Please enter the second word.")
document.write(firstword + secondword)
</script>
</head>
<body>
</form>
</body>
</html>
例:
最初の単語を入力してください:
カメ
2 番目の単語を入力してください
153
(プログラムは以下を出力します)
タートル.................................153