HTML Scripts
Insert a Script into a page
How to Handle Older Browsers
noscripts Tag
Scripts Tags
Insert a Script into a page
Add scripts to HTML pages to make them more dynamic and interactive.
A script in HTML is defined with the <script> tag
<html>
<body>
<script type="text/javascript">
document.write("hello world")
</script>
</body>
</html>
How to Handle Older Browsers
A browser that not recognize the <script> tag at all will display the <script> tag's content as text on the page.
To prevent the browser from doing this, you should hide the script in comment tags.
An old browser will ignore the comment, and it will not write the tag's content on the page.
on the other hand, a new browser will understand that the script shouldbe executed, even if it is surrounded by comment tags.
Javascript:
<script type="text/javascript">
<!-
document.write("Hello World")
//-->
</script>
VBScript:
<script type="text/vbscript">
<!-
document.write("Hello World")
//-->
</script>
for the browsers those do not suppors scripting
<html>
<body>
<script type="text/javascript">
<!--
document.write("if this is displayed, your browser supports scripting!")
//-->
</script>
<noscript>No Javascript support!</noscript>
</body>
</html>
noscript Tag
<noscript> tag is used to define an alternate text if a script is NOT executed.
This tag is used for browsers that recognize the <script> tag,but do not support the script inside,
so these browsers will display the text inside the <noscript> tag instead.
however, if a browser supports the script inside the <script> tag it will ignore the <noscript> tag.
Javascript:
<script type="text/javascript">
<!--
document.write("Hello world!")
//-->
</script>
<noscript>your browser does not support javascript! </noscript>
VBScript
<script type="text/vbscript">
<!-
document.write("hello world!")
'-->
</script>
<noscript>your browser does not support VBScript!</noscript>
Script Tags
TAG Description
<script> Defines a script
<noscript> Defines an alternate text if the script is not executed
<object> Defines an embedded object
<param> Defines rutime setting(parameters) for an object
<applet> Deprecated. use <object>instead
Insert a Script into a page
How to Handle Older Browsers
noscripts Tag
Scripts Tags
Insert a Script into a page
Add scripts to HTML pages to make them more dynamic and interactive.
A script in HTML is defined with the <script> tag
<html>
<body>
<script type="text/javascript">
document.write("hello world")
</script>
</body>
</html>
How to Handle Older Browsers
A browser that not recognize the <script> tag at all will display the <script> tag's content as text on the page.
To prevent the browser from doing this, you should hide the script in comment tags.
An old browser will ignore the comment, and it will not write the tag's content on the page.
on the other hand, a new browser will understand that the script shouldbe executed, even if it is surrounded by comment tags.
Javascript:
<script type="text/javascript">
<!-
document.write("Hello World")
//-->
</script>
VBScript:
<script type="text/vbscript">
<!-
document.write("Hello World")
//-->
</script>
for the browsers those do not suppors scripting
<html>
<body>
<script type="text/javascript">
<!--
document.write("if this is displayed, your browser supports scripting!")
//-->
</script>
<noscript>No Javascript support!</noscript>
</body>
</html>
noscript Tag
<noscript> tag is used to define an alternate text if a script is NOT executed.
This tag is used for browsers that recognize the <script> tag,but do not support the script inside,
so these browsers will display the text inside the <noscript> tag instead.
however, if a browser supports the script inside the <script> tag it will ignore the <noscript> tag.
Javascript:
<script type="text/javascript">
<!--
document.write("Hello world!")
//-->
</script>
<noscript>your browser does not support javascript! </noscript>
VBScript
<script type="text/vbscript">
<!-
document.write("hello world!")
'-->
</script>
<noscript>your browser does not support VBScript!</noscript>
Script Tags
TAG Description
<script> Defines a script
<noscript> Defines an alternate text if the script is not executed
<object> Defines an embedded object
<param> Defines rutime setting(parameters) for an object
<applet> Deprecated. use <object>instead
No comments:
Post a Comment