JavaScript

JavaScript Source Code

Free JavaScript Source Code. Download 10 latest JavaScript with source code for free here.

Detecting Unsaved Work in Javascript

Submitted by GeePee on
This project will teach you how to trap your user with an unsaved work. It has only few lines of code in javascript. If the user has unsaved work and application that is not completed and attempt to close the window, the pop up message will appear asking if you want to leave the page or stay on the page. Simple yet very useful. Hope you learn from this.

Pick Up Keyboard Input in Javascript

Submitted by GeePee on
This project will teach you how to pick up keyboard using javascript. Once the user press the key, it will display what key has been pressed and its keycode. It can also detect keyboard properties. You will notice that when the user press the key and hold, it has a status onkeydown event for whatever key user pressed and on released, it changes to onkeyup event. This is very useful in creating

Creating Links That Open in a New Window Using Javascript

Submitted by GeePee on
This project will teach you how to create a link that open in a new window using javascript. It is easy and useful with just a few lines of codes attached. There are options to modify the new window opened. You can either display the status bar, menu bar, directories bar, you can also either put a scroll bar, where to position the new window in your screen and the size of the new window. Hope you

Drawing Text in Canvas Using Javascript

Submitted by GeePee on
This project will teach you how to draw text in canvas using javascript. Let's see the parameters that the filltext method and stroketext method intake. context.fillText('This is the text!', 20, 60); context.strokeText('This is the text!', 20, 60); The first parameter is the string of text, second is the x position, and the third is the y position. You can also maximum width. It is optional. We

Change Stylesheet in Javascript

Submitted by GeePee on
This project will teach you how to change the web page stylesheet using javascript. I have here in my example the 3 different buttons. On click of the button, the sizes or the web page style will automatically change according to the style you set up. I have 3 different styles(small, medium, large), so I have also to create 3 stylesheet named small.css, medium.css and large.css. It is easy and it

Date Object in Javascript

Submitted by GeePee on
In this project, you will learn about date objects in javascript. The Date object is used to work with date and time. And this is the default functional key. var date = new Date(); The following are the Date Objects method. We will work only with the date. var month = date.getMonth(); Returns the month from 0 to 11. var day = date.getDate(); It will return the day of the month. var year = date

Arrays and Timed Loops in Javascript

Submitted by GeePee on
This project will teach you how to program arrays and timed loops in javascript. In the last project, we used timed loops in changing image, but this time we will use it in text animation. We use split method and uses empty string as the separator(the string will split between each character). The animation then looks like you're typing a text. Hope you learn from this project.

Using a Timer in Javascript

Submitted by GeePee on
In my previous project Changing Image Source, we change images by clicking. But what if we want to change them automatically and continuously? We have to use a timer on it. With just few lines of codes added in our previous project, we can make it work. var timer = setInterval('changeImg()', 3000); We will use setInterval method. Inside of it is the 2 arguments. First is the code that you want to