- ✕This summary was generated using AI based on multiple online sources. To view the original source information, use the "Learn more" links.
The <script> tag is used to embed a client-side script (JavaScript) in an HTML document. It can contain scripting statements or point to an external script file through the src attribute.
Example
<!DOCTYPE html><html><body><h2>My First JavaScript</h2><button type="button" onclick="document.getElementById('demo').innerHTML = Date()">Click me to display Date and Time.</button><p id="demo"></p><script>document.getElementById("demo").innerHTML = "Hello JavaScript!";</script></body></html>Copied!✕CopyUsage
Inline Script
You can write JavaScript code directly within the <script> tag.
<script>alert("Hello, World!");</script>Copied!✕CopyExternal Script
You can also link to an external JavaScript file using the src attribute.
<script src="myscript.js"></script>Copied!✕CopyAttributes
async: Specifies that the script is executed asynchronously.
defer: Specifies that the script is executed when the page has finished parsing.
type: Specifies the media type of the script.
Notes
【JavaScript】スクリプトの記述方法まとめ - Qiita
HTML script tag - W3Schools
Learn how to use the HTML tag to embed a client-side script (JavaScript) in your web page. See examples, attributes, browser support, and related pages.
<script>: スクリプト要素 - HTML | MDN
<script> は HTML の要素で、実行できるコードやデータを埋め込むために使用します。 ふつうは JavaScript のコードの埋め込みや参照に使用されます。 <script> 要素は WebGL の GLSL shader プロ …
JavaScriptの書き方、基本ルールをコードつきで徹底解説! | 侍 ...
Dec 29, 2025 · この記事では JavaScriptの基本的な書き方 を、初心者向けにわかりやすく解説します。 コードも一緒に説明しますので読めばすぐ、JavaScriptを動かすことができます。
JavaScript入門:JavaScriptの基本から実践的な利用方法 …
Feb 14, 2026 · JavaScript入門です。 JavaScript を使ったプログラミングをこれから始められる方を対象として、 JavaScript の基本から実践的な利用方法まで、わ …
Getting Started with JavaScript: Your First Script
In this blog post, we’ll guide you through the process of creating your first JavaScript script, covering fundamental concepts, usage methods, common practices, and best practices.
HTMLでscriptの書き方まとめ!使用例から使う時のポイントまで ...
Jun 5, 2024 · HTMLでは、スクリプトを使ってWebページに動的な機能やインタラクティブな要素を追加できます。 HTML内でタグを使って …
<script> - スクリプト - とほほのWWW入門
説明 <script> は、JavaScript などのスクリプトを記述するために用います。 主に JavaScript を実行するために使用されますが、VBScript など別のスクリプトも実行可能です。 JavaScript に関する詳細 …
JavaScript入門!作れるものやコード、勉強方法を初心 …
Sep 30, 2025 · プログラミングに興味がある方であれば「JavaScript」という言語を聞いたことがあるのではないでしょうか。 本稿では、JavaScriptとはどのような …
JavaScriptの基本① JavaScriptの使用方法 #初心者 - Qiita
Nov 21, 2024 · まず、HTMLに埋め込む記述方法でJavaScriptを記載してみます。 このscriptタグの中にコードを書く方法は、使用するJavaScriptのコードが少ない …