HTML Javascript

External Javascript
Javascript in script.js which has following code:


function Hello()
{
    alert("Hello, World");
}

<!DOCTYPE html>
<html>
<head>
<title>Javascript External Script</title>
<script src="script.js" type="text/javascript"/></script>
</head>
<body>
<input type="button" onclick="Hello();" name="ok" value="Click Me"  />
</body>
</html>

Internal Script

<!DOCTYPE html>
<html>
<head>
<title>Javascript Internal Script</title>
<base href="https://www.justeveryone.com/" />
<script type="text/javascript">
function functionname(){
   alert("Hello, World");
}
</script>
</head>
<body>
<input type="button" onclick="functionname();" name="ok" value="Click Me"  />
</body>
</html>

Event Handlers

<!DOCTYPE html>
<html>
<head>
<title>Event Handlers Example</title>
<base href="https://www.justeveryone.com/" />
<script type="text/javascript">
function EventHandler(){
   alert("I'm event handler!!");
}
</script>
</head>
<body>
<p onmouseover="EventHandler();">alert message</p>
</body>
</html>

noscript Element

JavaScript Example:
<script type="text/javascript">
<!--
document.write("Hello Javascript!");
//-->
</script>
<noscript>Your browser does not support Javascript!</noscript>
VBScript Example:
<script type="text/vbscript">
<!--
document.write("Hello VBScript!")
-->
</script>
<noscript>Your browser does not support VBScript!</noscript>

Default Scripting Language

<meta http-equiv="Content-Script-Type" content="text/JavaScript" />
 

Leave a Comment