Published on: 03 June, 2013

Your first Javascript Example

Tumblr Digg Google Plus

To use the Javascript is pretty straight forward. Firstly, there are two ways to use Javascript in your website.

1. Embed the Javascript codes in Html.

To embed the javascript codes, you just need to include a script tag into the html. See below example.

<script type="text/javascript">
	alert("Hello from Javascript");
</script>

2. Use external file for javascript.

To use the external file, you can just include a full script path like below.

	<script type="text/javascript" src="/js/javascriptFile.js"></script>
If you are using the second option which is external file, inside the javascriptFile.js, you do not need to include any javascript tag, which is <script type="text/javascript"></script>

Comments

There are no comments available.

Write Comment
0 characters entered. Maximum characters allowed are 1000 characters.