Published on: 03 June, 2013

Your first Javascript Example

Posted by andy | 1435 views 0 likes 0 favourites 0 comments
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.
Related Articles
Published on: 20 June, 2016
Google Analytics is one of the best free analytics site tracker. It gives you an idea the statistic of your visitors like the country they come from, the URL or keyword they search to go to your site or even the demographic or ages of your visitors. If you are a developer, you definitely do not want to track any data when you are in development phase. In this tutorial, you will learn how to disable google analytics for local development by using a javascript code if condition.