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 ハンズオンpart2

Last updated at Posted at 2025-10-29

イントロダクション

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

目次

  1. promptメソッド(sample27.html)

1. promptメソッド(sample27.html)

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

<!DOCTYPE html>
<html lang="ja">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>prompt</title>
</head>
<script>
window.prompt("あなたの名前は?","ここに入力します");
</script>
<body>
</body>
</html>

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

説明:

  • promptメソッド
    window.prompt("入力要求メッセージ","初期値")
    意味:入力支援ダイアログボックスを表示します。メソッドは以下のような記述をします。
    オブジェクト.メソッド(値)
    window.prompt("あなたの名前は?","ここに入力します");
    windowがオブジェクトで、promotがメソッドにあたります。
    入力要求メッセージダイアアログボックスに表示するメッセージを記載し、初期値にユーザー入力を行うテキストボックス内の初期値を入力します。

まとめ

最後までご覧いただきありがとうございます!!promptメソッドに取り組んでみました!次回はconfirmメソッドについて学んでいきます!

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?