0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JavaScript ハンズオンpart4

Last updated at Posted at 2025-10-30

イントロダクション

JavaScriptハンズオンpart1,2,3閲覧いただきありがとうございます!
この記事では、以下を参考記事等を活用しながらJavaScriptのハンズオンした内容をまとめます。
書籍『改訂版 演習 Webプログラミング入門』

目次

  1. writeメソッド(sample25.html)

1. writeメソッド(sample25.html)

書籍『改訂版 演習 Webプログラミング入門』4-2-1例題25のsample25.htmlを作成します。

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>write</title>
</head>
<script>
window.document.write("windowのdocumentに表示されました。","<br>"
,"改行して次の計算をしましょう。");
window.document.write("<br>8×2 =",8*2,"<br>");
window.document.write("画像を表示しましょう。<br>");
window.document.write("<img src='C:/HTML/image/tower1.jpg'>");
</script>
<body>
</body>
</html>

以下のWebページが作成されます!
image.png

説明:

  • writeメソッド
    window.confirm("確認ダイアログボックスメッセージ")
    意味:文字や画像を表示します。ブラウザに文字や画像表示されます。

①定義済みオブジェクト(JavaScriptで、すでに用意されているオブジェクト)

  • windowオブジェクト:Webブラウザそのものを扱うオブジェクト
  • documentオブジェクト:Webブラウザの表示領域を扱うオブジェクト
  • formオブジェクト:form要素を扱うオブジェクト
  • elementオブジェクト:テキストボックス、ボタンなどを扱うオブジェクト

②組込みオブジェクト(個別に独立したオブジェクト)

  • Dateオブジェクト:日付や時刻を扱うオブジェクト
  • Arrayオブジェクト:配列と呼ぶ連続的にデータを格納するオブジェクト
  • Mathオブジェクト:計算に関するオブジェクト
  • Stringオブジェクト:文字列を扱うオブジェクト

まとめ

最後までご覧いただきありがとうございます!!メソッドに取り組んでみました!次回はwriteメソッドとwrite/alertメソッドを使った練習問題について挑戦します!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?