Ad

html script tag attributes

html script Element 



The SCRIPT element  use to declare script, such JavaScript, within  HTML document  embedded external javascript file through src attribute. You can use the SCRIPT element for validating Web forms and manipulating the content and images present on these forms. 

<script>

document.getElementById("demo").innerHTML = "Hello JavaScript!";

</script>

 The SCRIPT element is used inside the HEAD element, which uses the type attribute. 


1 Introduction to scripts

client-side script is the program that the may accompany HTML document or be embedded directly. The program executes on client machine document loads, or some other time such as a link is activated. HTML support for independent scripting language.

Script offer authors is  extend HTML documents is highly active and interactive way.  example Script may  evaluated as document loads to the modify the contents of the document.

Scripts  accompany a form to process input  is entered. Designers may dynamically fill  parts form based on the values of other fields. They  ensure that input data conforms to predetermined ranges values, fields are mutually consistent, Script may be triggered by event that affect the document, such  loading, unloading, element focus, mouse movement, etc.

Attribute 

1. Async 

Value :- true, false

Description :-

classic scripts is the async attribute is present, the classic script will be fetched in parallel to parsing and evaluated available. For module scripts the async attribute is present  the scripts and all their dependencies will be executed . get fetched in parallel to parsing to evaluated soon as they are available.

This attribute allows  elimination of parser-blocking JavaScript browser would have load and evaluate scripts  continuing to parse. defer has a similar effect in this case. This is a boolean attribute: the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value.


2.  NOSCRIPT element


The NOSCRIPT element is used to the  display the alternate content  Web browser that does not support JavaScript or has JavaScript disabled. JavaScript is enabled to supported by  Web browser NOSCRIPT element not considered. The following code snippet shows an example of the NOSCRIPT element.

The noscript element to represents nothing scripting is enabled, and represents  children if scripting  disabled. It used to present different markup to user agents  support scripting and those don't support scripting, by affecting how the document is parsed.

<script type="text/javascript">

document.write("Good Morning.")

</script> 

<NOSCRIPT>Javascript is disabled or not supported on your browser.</NOSCRIPT>NOSCRIPT element can only applied on elements that inside the BODY element. If you do not want to apply script on any session of the BODY element, you can define it in the NOSCRIPT element. This element cannot contain any nested elements.


3 The STYLE Element:

The STYLE element is used to declare the style sheets within the HTML document. This element specifies how the HTML elements are rendered in a browser. The STYLE element has three attributes: type, media, and scoped. Generally, the STYLE element is placed inside the HEAD element but if you use the scoped attribute, then you can place the STYLE element in the BODY element of the document. The following code snippet shows the use of the STYLE element in a document:

<HEAD>

<STYLE type="text/css">

body (background-color: powderblue;}

hi (color: red;)

p [color: blue;)

</STYLE></HEAD>


In the preceding code snippet, the STYLE element is used within the HEAD element


Related Post :-

html form tag

html table attributes


No comments

Powered by Blogger.