ActionScript reference sites - 2006-02-13

A list of some of the more useful ActionsScript reference sites. These have tutorials on object oriented ActionsScript.

[ read more ]


Array.push() Javascript - 2006-02-13

This is a good one! Apparently IE on the mac doesn't support the Array.push() method of javascript. IE 5 on pc has the same problem. To solve the problem, you will have to define the last element of the array manually like this.

[ read more ]


Automatically expanding side navigation - 2006-02-13

Sooner or later, we all run into this problem while laying out your pages in CSS. Side navigation has a background color or pattern, and needs to be the same height as the content div. Some hacks will create one long background image to span both the side navigation and the content div, then set it as the background image of the container div.

[ read more ]


Disable Printing of a page - 2006-02-13

There are a couple of way of preventing your users from taking your content. While I am not sure why one would want to prevent a user from printing a page, I have had clients ask for this. There are a couple of ways of doing this. The first method involves javascript, and the second is a purely css solution.

[ read more ]


Disable right click - 2006-02-13

I had a few of my clients ask for this, so I thought I would put this script up for easy reference. This will prevent anyone with javascript turned on from right clicking anyware on the page. This method will not prevent a savy user from stealing your images, but it will deter many average users. This will work in IE 4+ or NS 4+.

[ read more ]


How to Clear Browser Cache - 2006-02-13

This is quick guide on how to clear your cache in most of the browsers. Browsers will store temporary information such as images, stylesheets and flash movies, and will display them even if you have updated the files. In order to see the most recent version, follow the steps in this article

[ read more ]


Javascript cookie functions - 2006-02-13

These are some useful javascript functions that you can use to manipulate cookies. Explanation for each of the functions are the comments above it.

[ read more ]


Minimum height hack - 2006-02-13

The CSS min-height property is not supported by MSIE, so in it's place we have to use a small workaround. Suppose you wanted to have a div that is 100px high, that will expand to fit the content. Setting the following property in CSS works in FireFox and Safari, but not in IE:

[ read more ]


Random image without repeat - 2006-02-13

You see this kind of thing all over the internet. An image is loaded randomly from a list of images, similar to what you see in the header of this site. This is nothing new; just use the Math.random() javascript method, and off you go. The problem is that if you only have a small number of images, often you will get the same image over and over again. Another problem arises when you have many images and would like to make sure the user will see as many of them as possible without repeating any of the previously seen images. With the above two issues in mind I came up with a piece of javascript that uses cookies to store a list of images seen and checks against that list to make sure images don't repeat. This code generates a random number from a specified quantity. See js comments for clarifications:

[ read more ]


Randomize array in php - 2006-02-13

Sorting an array is pretty straight forward, but what if you want to do the opposite? Here's a useful piece of code used to randomize an array in php. You can see this used in the thumbnail showcase on the left side navigation of this site. If you refresh the page, the thumbnails are randomly pulled from the showcase. To achieve this, you will need to take 3 steps:

[ read more ]


Remove white space from text for flash - 2006-02-13

If you work with flash, you probably have run into this problem before. You need to load some html formatted text into flash. So you open up your favorite html editor, and start formatting your text. Of course, html editors will add some tabs and returns to make the code easier to read. Unfortunately, flash will take all those formatting characters and display them. So you get unwanted tabs and returns all over your text. What do you do? Well, you go into the text, and manually remove every tab and return character, rendering your html unreadable by all except Flash.

[ read more ]


Using a print stylesheet - 2006-02-13

If your website has content that users are likely to print, it is a good idea to create a separate stylesheet just for print. There are a couple of things that you would need to do to allow users to print your page in a printer friendly format. In most cases you will want to hide the menu bar, get rid of any background graphics or colors, make the text a nice legible size, and display any internal links in readable rather than clickable fashion. Here's a stylesheet that takes care of these things.

[ read more ]