<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.kjodle.net/index.php?action=history&amp;feed=atom&amp;title=Script_Tag</id>
	<title>Script Tag - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.kjodle.net/index.php?action=history&amp;feed=atom&amp;title=Script_Tag"/>
	<link rel="alternate" type="text/html" href="https://wiki.kjodle.net/index.php?title=Script_Tag&amp;action=history"/>
	<updated>2026-05-13T00:10:15Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.1</generator>
	<entry>
		<id>https://wiki.kjodle.net/index.php?title=Script_Tag&amp;diff=1161&amp;oldid=prev</id>
		<title>Kenneth John Odle: Created page with &quot;The &lt;script&gt; tag has three applications:  # When used in the &lt;head&gt; element, it can contain JavaScript statements. # When used in the &lt;body&gt; element, it can contain JavaScript...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.kjodle.net/index.php?title=Script_Tag&amp;diff=1161&amp;oldid=prev"/>
		<updated>2015-07-08T00:37:20Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;The &amp;lt;script&amp;gt; tag has three applications:  # When used in the &amp;lt;head&amp;gt; element, it can contain JavaScript statements. # When used in the &amp;lt;body&amp;gt; element, it can contain JavaScript...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;The &amp;lt;script&amp;gt; tag has three applications:&lt;br /&gt;
&lt;br /&gt;
# When used in the &amp;lt;head&amp;gt; element, it can contain JavaScript statements.&lt;br /&gt;
# When used in the &amp;lt;body&amp;gt; element, it can contain JavaScript statements. This use is '''not''' recommended.&lt;br /&gt;
# When used in the &amp;lt;head&amp;gt; element, it can be used to load external JavaScript files.&lt;br /&gt;
&lt;br /&gt;
== In the &amp;lt;head&amp;gt; Element ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!doctype html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;script&amp;gt;&lt;br /&gt;
            window.alert(&amp;quot;JavaScript is active&amp;quot;);&lt;br /&gt;
        &amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== In the &amp;lt;body&amp;gt; Element ==&lt;br /&gt;
&lt;br /&gt;
Again, this usage is '''not''' recommended. Best practices dictate that content and function remain separate.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!doctype html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
         &amp;lt;button onclick=&amp;quot;alert('JavaScript is active');&amp;quot;&amp;gt;Click me&amp;lt;/button&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== In the &amp;lt;head&amp;gt; Element to Load External JavaScript Files ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;!doctype html&amp;gt;&lt;br /&gt;
&amp;lt;html&amp;gt;&lt;br /&gt;
    &amp;lt;head&amp;gt;&lt;br /&gt;
        &amp;lt;script src=&amp;quot;myscript.js&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;
    &amp;lt;/head&amp;gt;&lt;br /&gt;
    &amp;lt;body&amp;gt;&lt;br /&gt;
    &amp;lt;/body&amp;gt;&lt;br /&gt;
&amp;lt;/html&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This method does '''not''' work within the &amp;lt;body&amp;gt; tag. If you want to load external JavaScript files, you must do so from within the &amp;lt;head&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
== HTML Compliance ==&lt;br /&gt;
&lt;br /&gt;
=== HTML5 ===&lt;br /&gt;
&lt;br /&gt;
In Javascript, the proper notation for HTML5 has no [[attribute]]s:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script&amp;gt;&lt;br /&gt;
   ...JavaScript statements...&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== HTML4 ===&lt;br /&gt;
&lt;br /&gt;
When used in [[HTML4]] or [[XHTML]], the &amp;lt;script&amp;gt; tag '''must''' include the [[type]] attribute:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
&amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;&lt;br /&gt;
   ...JavaScript statements...&lt;br /&gt;
&amp;lt;/script&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Deprecated Attributes ===&lt;br /&gt;
&lt;br /&gt;
At one point, the ''language=&amp;quot;JavaScript&amp;quot;'' attribute was required. It has long been [[deprecated]] and should not be used.&lt;br /&gt;
&lt;br /&gt;
[[Category:JavaScript]]&lt;/div&gt;</summary>
		<author><name>Kenneth John Odle</name></author>
		
	</entry>
</feed>