Category: JavaScript

Build an HTML5 Game: Some Reviews

Build an HTML5 Game: Some Reviews

I’ve found three decent reviews for my book “Build an HTML5 Game“, and especially pleasing is the fact that two of them seem to be from exactly the target audience i.e. developers with existing web skills who didn’t realise how easy it would be to use those skills to build a game. First up, there’s …

+ Read More

Build an HTML5 Game – 40% Early Access Discount

Build an HTML5 Game – 40% Early Access Discount

My book Build an HTML5 Game in going to be out in a couple of months, and until around 4pm on January 31st 2015 you can get 40% off with the discount code BRIGHTANDEARLY if you buy it here: http://www.nostarch.com/html5game The discount applies to ebooks or the physical copy too, although it’s only if you’re …

+ Read More

A New Venture: Wedu Games

A New Venture: Wedu Games

My new venture, Wedu Games, is up and running. Or at least the site is as there are no games finished yet. There are a few things in development, though, including an interactive storytelling table app (that isn’t a game at all) and a stud/hold-em poker hybrid to launch on mobile and Facebook together. Everything’s …

+ Read More

Repeatable random numbers in JavaScript

Repeatable random numbers in JavaScript

Ever since programming BASIC on the Spectrum I’d wondered why it was possible to seed a “random” number generator. But then I found I wanted to do something that would produce repeatable results, but look like a random sequence. Strangely, although JavaScript alongs you to specify a seed for Math.random() the numbers that follow aren’t …

+ Read More

Firing JavaScript functions after a .Net AJAX request

Firing JavaScript functions after a .Net AJAX request

I wanted to have a function called after data was returned to the page from a .Net AJAX call. (The idea was to fade out when you pressed “submit” and then redraw when data came back.) It turns out there are handy handlers already there to, erm, handle this: Sys.WebForms.PageRequestManager.getInstance() .add_beginRequest(StartRequestHandler); Sys.WebForms.PageRequestManager.getInstance() .add_endRequest(EndRequestHandler); Those little …

+ Read More

JavaScript solution to PNG alpha transparency in IE

JavaScript solution to PNG alpha transparency in IE

Solutions to the problem of PNG alpha transparency in IE6 have been around for a while, as exemplified by this post on Cross-Browser Variable Opacity with PNG on A List Apart. This solution uses script to write in the correct html, or to pass variables to a script and set a property of an object. …

+ Read More

More JavaScript haiku

More JavaScript haiku

I first published a JavaScript haiku called ‘Fear of tomorrow’ here. Well, I’ve written some more. Apparently these are more likely to be classed as Senryuu, but what do I know. Anyway, here are some others that I’ve written, with the code first and the way it’s supposed to be read following it, and then …

+ Read More

Deleting page elements using removeChild in JavaScript

Deleting page elements using removeChild in JavaScript

Here’s a handy(?) script to delete pieces of any page you’re on when you click on them: javascript:document.onclick=new Function(‘e’,’document.all?src=event.srcElement:src=e.target;src.parentNode.removeChild(src);return false’);void(0); Go to any page on the web, paste it into the address bar of your browser and then start clicking around. It works okay in IE6 and Firefox – I haven’t tried it in anything …

+ Read More