UltraMega Tech.
21Dec/0827

Reloading Images Using JavaScript

There are some situations where you want to reload an image without refreshing the page containing it. This is especially handy with CAPTCHA images, where you might want to give the user the option to get a new code in case the first is too hard to read.

It sounds simple enough, but then there is browser caching that you need to work around. Fortunately, this problem is easy to solve just by altering the URL of the source, adding a unique string to the end (such as a timestamp) as a GET parameter. Here is a little JavaScript function that will accomplish this:

15Dec/082

Toggle Display of Page Elements with JavaScript

This mini tutorial explains how to show/hide elements on a web page using JavaScript. There are many reasons why you would want to do this, and luckily it is very simple.

All it takes is changing the display CSS property. Setting display: block; (the default for div tags) makes it visible, and display: none; makes it hidden. The advantage to using display is that other items on the page will move to close the void left by the hidden object.

13Dec/081

What is AJAX?

AJAX stands for Asynchronous JavaScript and XML. Many modern websites, big and small, implement this technology in many different ways, but what exactly is it? Here is an explanation in simple terms...

An AJAX application is a web page that functions more like a desktop application than a traditional web page in that it feels more responsive. It works by transferring small pieces of information in the background and updating just the affected area of the page without reloading the whole thing. This not only speeds up web applications and lowers bandwidth consumption, it also increases end-user enjoyability. As AJAX becomes more popular, the gap between the Internet and desktop applications will become increasingly smaller.

3Dec/08Off

Creating an Upload Progress Bar in PHP with APC

Note: Please check out this updated tutorial for creating an upload progress bar. This tutorial is outdated and may not produce the desired effect.

Introduction

In this tutorial I will explain how to create a progress bar for PHP file uploads. There is no method built into PHP for returning the status of an upload in progress, so this requires a module called the Alternative PHP Cache (APC). This allows you to store data across sessions and includes built-in functionality for storing/returning file upload stats.