<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="JustSystems Homepage Builder Version 18.0.14.0 for Windows">
<title>JavaScript練習中!</title>
</head>
<body background="y8b.gif">
<?php
require_once ("newpage8.php");
print $APPTITLE;
MyTitlePrint("JavaScript02.php実験開始!");
?>
<script>
<!--
//ここにJavaScriptを書くよー
document.writeln("こんにちは、JavaScript.");
var astr = "よろしくお願いいたします。";
document.writeln(astr);
var a = 10;
var b = 20;
document.writeln(a + b);
//-->
</script>
<?php
print "$APPFOOTER";
?>
<p><a href="JavaScriptMenu.php">JavaScriptMenuへ</a></p>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="ja">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="JustSystems Homepage Builder Version 18.0.14.0 for Windows">
<title>JavaScript練習中!</title>
</head>
<body background="y8b.gif">
<?php
require_once ("newpage8.php");
print $APPTITLE;
MyTitlePrint("JavaScript02.php実験開始!");
?>
<script>
<!--
//ここにJavaScriptを書くよー
document.write("こんにちは、<strong>JavaScript。</strong><BR>");
var astr = "よろしくお願いいたします。<BR>";
document.write(astr);
var a = 10;
var b = 20;
document.write("a + b = ",a + b + "<BR>");
document.close();
//-->
</script>
<?php
print "$APPFOOTER";
?>
<p><a href="JavaScriptMenu.php">JavaScriptMenuへ</a></p>
</body>
</html>
ducument.writelnで出力はされますが、すべて同じ行にされます。なんでか?答えは、言われればわかるですね。(*_*;文字としての”<BR>”を付ければ、改行します。あたりまえの話、ですが、わすれるんですよ。人間だもの。
結構時間かかりました。