javascript を齧り始めた。
1_
以下の初心スクリプト;;
『
document.write(‘Hello World!!’);
』
2_
chrome のその他のツール>デベロッパーツール>
のコンソールで実行する。
と・・・・
「
VM62:1 Uncaught TypeError: Failed to execute ‘write’ on ‘Document’: This document requires ‘TrustedHTML’ assignment.
at <anonymous>:1:10
」
3_
以下がコンソール用だ。
『
console.log(‘hello world‘);
』
4_
chrome のその他のツール>デベロッパーツール>
のコンソールで実行する。
めでたく・・・
「
hello world
」
だ。
5_
javascript は一般にはhtmlファイルに埋め込んで使用されるわけだ。
こんなhtml ファイルを。
『
<html>
<head>
<meta http-equiv=”content-type” content=”text/html; charset=UTF-8“>
<title></title>
</head>
<body>
<script>
document.write(‘Hello World!!’);
</script>
</body>
</html>
』
これをhtmlファイルとして保存する。
6_
例えば、firefox で上記htmlファイルを読むと・・・
めでたく
「
Hello World!!
」
となった。
——-
今日はここまで学んだ。
—-

コメント