Here is a little fun thing to do in the lab: changing colors. If you have a little javascript project and you want to make it fun, this little color morphing script can come in handy. It opens up the door to understanding how the color components on your screen works. The combination of red, green and blue to make up a color you see on a screen can be shown in this little experiment. Here are the codes:
<html>
<head>
<script>
var runTimer;
var rCom, gCom, bCom;...
Monday, November 17, 2014
Tuesday, November 11, 2014
Auto Copyright Year Javascript
In order to avoid visitors to see outdated copyright information or having someone to help out updating the copyright year on every new year, a simple Javascript can do the job easily. Here is an example of how it is done in a simple web page with a dummy copyright text:
<html>
<body>
© copyright 2007-<span id=currentYear>2013</span>. All rights reserved.
<script>
var thisYear = new Date().getFullYear();
document.getElementById('currentYear').innerHTML...
Monday, November 10, 2014
Create Dynamic Google Map using Javascript
Why do we need to use Javascript to generate Google map dynamically? The answer is speed. If we tell our browser to load everything at the same time, everything will be loaded slower compared to letting browser to complete the important ones before the non-critical one such as the Google map.
I've done some testing and it shows that Google is slowing down the loading of other items on a web page. I compare the loading time of a web page with and without Google map. The one with concurrent...
Subscribe to:
Posts (Atom)