Classes, Properties, Methods and Ships Javascript is an object oriented (OO) programming language. Many object oriented programming languages, such as Java and ActionScript, are class based. A ‘class’ acts as a blueprint for objects or instances created from the blueprint. We may, for example, have a class ‘Ship’ that defines the basic characteristics of a…
Read MoreWith Javascript 1.6 we have some new ways to manipulate arrays. To check whether your favourite browser supports these consult this compatibility table. indexOf() and lastIndexOf() Avid readers will recognize indexOf() and lastIndexOf() from a previous post on string manipulation. These methods are now available for arrays and are used to search an array for…
Read MoreA Pop and Push and this land is ours With Javascript arrays there are a host of methods allowing us to manipulate the content. We’ll start with the ‘traditional’ array methods. pop() – to remove the last element Given an array of: We can pop() the last value with: … and that would be ‘Combat…
Read MoreOften with date based data, such as events listings, you may need to extract all the records that match a particular calendar month. Here all you need from the user is a month and year. Then you can let SQL do the rest, for example: The explanation bit: the magic here is done by DATE_ADD…
Read MoreA couple of useful ‘vanilla’ Javascript methods that are a little ignored although they have been around since DOM2. The hasAttributes() Method This checks to see if an element has any attributes and a boolean value – true for yes indeedy and false for nope soz is returned. Take this HTML snippet: If we need…
Read MoreAs part of my occasional series on PHP string manipulation here is a quick PHP function designed to retrieve the file extension from a file path. If you get mixed case file extensions ie ‘image1.jpg’ and ‘image2.JPEG’ then use this variant that will return the file extension in lowercase. For others in this series try:…
Read MoreAs part of my occasional series on string manipulation in Javascript here I offer some tricks for working with URLs. You might also like Addressing the Problem – String Manipulation with Javascript or replaceAll(). Manipulating the URL of the page you are on To get the URL of the page you are currently on use:…
Read MoreTo demonstrate Objects in PHP I put together a calendar include. View Demo. The calendar was created in a PHP file to use as an include. The code was as follows: This was then included on the page with: And the resultant table was styled up with the following CSS: Now how many days is…
Read MoreAs we enter a new ‘post-Flash’ era Adobe are piling in with ‘HTML5’ tools. Flash Professional CS6 can be used to create Javascript animation via the createJS framework. Adobe have released an extension for Flash Professional called the Toolkit for CreateJS that lets you build an animation in the traditional way and then export it…
Read MoreTo accompany the mysqli cheatsheet here is a PDO cheatsheet. Give me one record Give me the whole lot One row from user input using prepare Multiple rows from user input using prepare INSERT Get Last Insert ID UPDATE DELETE
Read More