Example of inline scripts in java script

When scripts are executed from top to bottom, means your script appear in both <head> as well as <body> section. No one scripts is executed inside the tag known as inline scripts. Let’s take a simple example.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript" >
    alert("Hello");

</script>
    <title></title>
</head>
<body>
<script type="text/javascript" >
    alert("World!");

</script>
</body>
</html>

Code Generate the following output

Example of inline scripts in java script

Example of inline scripts in java script
Example of inline scripts in java script Example of inline scripts in java script Reviewed by Jacob Lefore on April 06, 2015 Rating: 5

No comments