Showing posts with label js. Show all posts
Showing posts with label js. Show all posts
Monday, 3 October 2011
Wednesday, 23 March 2011
JS inheritance
An easy way to do JS inheritance:
http://ejohn.org/blog/simple-javascript-inheritance/
http://ejohn.org/blog/simple-javascript-inheritance/
Sunday, 21 November 2010
JS Game programming main loop
Use this piece of JS to repeatedly call update() method every 10ms.
Handy for game loops!
setInterval(update, 10);
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
Full breakout game guide with keypress, mouse & animation
Handy for game loops!
setInterval(update, 10);
http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/
Full breakout game guide with keypress, mouse & animation
Saturday, 25 September 2010
Javascript Color Looping
If you find yourself looping thru JS code to tweak the color settings:
// Sets myColor to be the Hex AA + a sample integer
var myColor= 0xAA + parseInt(20)
// toString(16) turns a decimal int into a Hex value.
var colorToUse = myColor.toString(16)
// Sets myColor to be the Hex AA + a sample integer
var myColor= 0xAA + parseInt(20)
// toString(16) turns a decimal int into a Hex value.
var colorToUse = myColor.toString(16)
Saturday, 7 November 2009
Javascript inserting nodes
Remember when using the 'insertBefore' method that the node you **think** is the parent isn't necessarily the parent.
So dont do :
Instead do this:
<h1 id='header'>
<p id='beforeMe' />
</h1>
So dont do :
header = document.getElementById('header');
beforeMe = document.getElementById('beforeMe');
header.insertBefore(newNode, beforeMe );
Instead do this:
beforeMe = document.getElementById('beforeMe');
beforeMe.parentNode.insertBefore(newNode, beforeMe );
Wednesday, 19 August 2009
JS - Get object which called this method
Sample HTML + JS.
JS gets the tag which originally called the JS method. It can then read the value on the original 'input' tag
JS gets the tag which originally called the JS method. It can then read the value on the original 'input' tag
<html>
<head>
<script>
function flipFormTarget(e) {
alert(e.value)
document.getElementById('old-form').setAttribute('action', e.value);
}
</script>
</head>
<body>
<br><input type = 'radio' value = 'top one' onclick="flipFormTarget(this)" checked>top option
<br><input type = 'radio' value = 'bottom one' onclick="flipFormTarget(this)"> bottom
</body>
</html>
Thursday, 30 July 2009
CSS & JS resources
Cool css table site:
http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs/
Cool css shell files:
http://code.google.com/p/css-boilerplate/
JavaScript libraries;
http://jquery.com/
Great Javascript Guide
https://developer.mozilla.org/en/JavaScript/Guide
Chrome Web Development extentions:
http://sixrevisions.com/tools/chrome-extensions-developers-designers/
Pretty & Searchable JS Lists
My Slidey HTML updating list from RSS
JS to do a website tour
My Creations:
Share button
http://www.smashingmagazine.com/2008/08/13/top-10-css-table-designs/
Cool css shell files:
http://code.google.com/p/css-boilerplate/
JavaScript libraries;
http://jquery.com/
Great Javascript Guide
https://developer.mozilla.org/en/JavaScript/Guide
Chrome Web Development extentions:
http://sixrevisions.com/tools/chrome-extensions-developers-designers/
Pretty & Searchable JS Lists
My Slidey HTML updating list from RSS
JS to do a website tour
My Creations:
Share button
Subscribe to:
Posts (Atom)