Tag Archives: Tips

Some Tips to Become a Good Web Designer

A good designer is one who can create great designs long
after the phenomenon called Web 2.0 has passed. It is true
that becoming master at web designing takes many years of
experience.

However, it is also rooted in learning the fundamentals
well. Time has proven that the basics work and they should
always be the most important tools that any designers
should have.

Here are some important skills that help one become a good website designer.

1. Simplicity

- this is somehow connected with the first skill.
Simplicity is not making things bare and dull, but it is
making things work. A simple design will always have its
timeless appeal and it will always help new visitors of
websites navigate the site easily.

2. Subtlety

- each era will have its own sense of style. Amateurs will
always exploit the new trends and use it on every occasion
possible. But this makes designs look amateurish and tacky.
Great designers, on the other hand, learn the new styles
and keep its use to a minimum.

3. Willingness to Learn

- another important thing about great designers is that they
never cease to learn. For them, there is something new to
pick up everyday. The willingness to learn helps designers
stay fresh and relevant even styles and tastes have
changed.

4. Knowledege of latest web technologies

- this is important when you wish to create a good design as per latest trends. A good graphics editor can do jobs such as
simple photo editing to more complex ones such as creating
gradient and reflection effects. Photoshop and GIMP are
popular graphics editors used by designers.

5. Look at what your competitor are doing

Take a look at what other web designers are doing. You must be aware of latest happening in your industry. There are several design gallery sites that showcase some fine work. Learn what these designers are doing and how they are doing it. Don?t copy, be inspired!

The things listed above although appears easy o follow.
However, things are different in the real world. There will
always be the temptation to design like the rest. But as
always, best designers will always find ways to stand out.

Top 3 Social Networking Web Design Tips

We have seen many social networking sites to gain quick popularity while a very few didn’t make it up to the mark. With almost one year now, through which the social networking websites gained ultimate popularity, now is the ideal time to look into the successful social networks for some unique social networking web design tips. Here are 5 main points that has to be noted for a successful social networking website design.

3. Learning from the mistakes that other social networks have made

As already said, while many social networking sites like myspace, Facebook etc have gained popularity, a few other social networking sites have disappeared in the Internet crowd. As the old saying goes, “The only real mistake is the one from which we learn nothing.” Hence it’s necessary to learn from the mistakes that the other social networks made. One of the biggest mistakes that some of the social networking web designers make is overloading their web page with heavy graphics. They have a misconception that attracting visitors to social networking website depends all on eye candy. Loading a web page with heavy graphics will end up in longer load times. The visitors of your website won’t be patient enough to wait for the page to load. This will make the visitors quit from the page and they never return to your social networking website. Hence make the social networking web design simple and user friendly.  

2. Increase the interactivity of your Social Networking website

With the advancements in online marketing and SEO techniques, driving visitors to your social networking website is easy today. It’s upto the effective social networking web design to make the visitors spend some time in your site and also become returning users. For this, some interactive stuff must be added to the social networking website. Apart from the common social networking features like making friends and exchanging messages some other interactive fun stuff can be added to the social networking website. The social networking softwares come in handy here. There are many social networking software that can be used in your social networking website, which will be fun for the users. They will be pleased to return to your site to use the social networking applications and moreover, they will refer your site to their fiends too.

1. Be unique

Social networking websites are emerging like mushrooms today. At this point, just think in a social networking users point to view. With thousands of social networking websites out there, why should they choose your social networking website? The answer is simple “Make it unique”. Provide the visitors of your social networking website something that the similar networks haven’t offered. Be sure that the unique offerings at your social networks are useful too.

Bottom line

People consider privacy much more important than anything today. Hence it is essential for your social networking web design to ensure the privacy of the visitors of your site.

Nine Tips for a Profitable Blog

There’s no doubt that more businesses are realizing the power of blogging to establish their expertise, rank higher at the search engines, and improve their communication with prospects and customers.

But as more companies jump into the blogosphere it becomes more difficult for your blog to get noticed, and therefore to make you money. Here are nine quick tips to make your blog a profitable marketing tool.
1. Blog for your audience. As the blogosphere matures, the face of business blogging is changing as well. Although the discourse can still be freer than your Web site or email newsletter, people want content they can use. A few posts in a row about what you had for breakfast and you’re toast.
2. Make your blog search engine friendlier. Blogs are search engine friendly by design. By choosing keyword-rich category names and writing keyword-rich post titles you can greatly increase your search engine visibility and drive more qualified leads to your site.
3. Engage your most active commenters. Some blogs naturally attract more comments because of their popular or controversial topics. You can increase the comments on your blog by responding to each commenter in an email, linking back to or commenting at their blogs, and mentioning them by name in later posts.
4. Comment on influential blogs in your niche. Find the influential bloggers in your niche(s) through a Technorati search and read their posts. When you have something intelligent to add to the conversation, comment away. These comments create links to your own blog, and should drive some more traffic your way.
5. Submit your site to blog directories. When I started developing Web sites getting listed in Yahoo took an email. Now it takes $299…a year. Submit your site while it’s (mostly) free.
6. Promote your blog’s newsfeed. Every blog platform creates a feed for syndication, but some blogs don’t have it easily available. Make sure your is obvious.
7. Add an email subscription. Although newsfeeds are important, not all of your readers will understand how to subscribe to one. Everyone, however, understands how to subscribe to an email newsletter. I recommend using Feedburner for this task, as it also allows you to easily create newsfeeds and track subscribers.
8. Include social bookmarking links. Getting a post into Digg, del.icio.us, StumbleUpon, or any of the popular social networking/bookmarking sites, can generate thousands of additional page views. Make it easier on visitors to promote your posts by including links to these services within every post.
9. Leverage your blog traffic into real business. Don’t forget that this is your business blog, not your personal one; you’re looking for a return on investment. Create appropriate calls-to-action in the form of links that drive traffic from your blog to your Web site or online store.

Just don’t be too heavy handed; visitors won’t become subscribers or customers if you’re doing nothing but self-promotion. Use a deft hand to establish your expertise and build relationships with readers, but make it easy for them to buy from you when they’re ready.

While every item in this list will help make your blog more profitable, pay most attention to the first and last tips. Blog for your customers because nothing else will have an impact if you don’t focus on their needs. Blog for your business because the purpose of a business blog is to help your company grow and succeed.

Three Tips to Getting Internet Traffic to Your Blog Website

Everybody has a blog. No matter the topic or discussion someone has got it covered. From online diaries in the mid nineties to becoming one of the foundations of the internet, blogging along with video and social bookmarking is changing not only how we get our information but also the manner in which online business is conducted.

This is why it would be a good idea for you incorporate blogging into your overall internet marketing plan. What blogging can do very effectively is to build your target markets and bring you a steady flow of internet traffic and customers.

Email Marketing List

In a recent survey, 100% of online users say they communicate using email. This is a good way to send messages to your opt in email list with links going back to your blog web site. Let them know you have posted a new article or video on your blog. Use snippets or summaries to entice people to click on the link and get further information. The more times people on your list see your blog the more they will get to know you and give a second look to some products or services you maybe offering.

In addition you can gain more viewers to your blog by giving away a subscription along with free report. Advertise in ezine publications that target your niche as well as forums and classified ad sites like US Free Ads.

Free RSS Feed

Rich Site Summary also known as Really Simple Syndication is the process of delivering constantly updated content to your blog by pacing a block of code known as a feed on your webpages. In our fast paced information age  RSS fits perfectly. It allows your visitors to stay up to date on any new information you have added to your blog without necessarily having to visit every page on your blog. Instead they view a window that list the headlines followed by a quick summary of what each article is about.

Having a free RSS feed accomplishes two things besides getting more site traffic. First since the content is updated frequently it keeps the search engines coming back to your site and crawling for the new information, Second it can increase your visibility among your blog visitors. This is important because while they may not visit your blog everyday, providing a feed to your subscribers is a good way to for them to stay in touch.

Network

A blog network is a compilation of blogs under a sole domain or company name. Some web visitors take comfort in clicking a link that takes them to different bloggers who cover the same topic. This is also an excellent way to get free advertisement and free web traffic to your site since people who visit the network will invariably be exposed to your blog.

You can also submit to blog directories or just ask your readers to give you feedback on something you posted. No matter which technique you choose, blogging offers a new way to connect with your readers. Simple, unfiltered and a perfect fit for internet, blogging is a smart resource to have in your internet marketing online tool kit.

Web Design Tips

When someone sees a beautiful web design, he or she can’t help but fall in love with it and wonder how it was done. However, designing a web would take more than just your knowledge in color, texts and images. It involves codes. But you can learn those in no time so there’s nothing to worry about. Moreover, there is a science behind web design and the following could help you be more scientific with your designs

Usability Testing

The secret here is to let someone who is not familiar with your site have a look at it. As much as possible, be in the room while they are testing your site. Take note of the things that they click on and the things that they ignore so you will know what to improve.

Browser Testing

Do not make the mistake of thinking that your web page will look good at any other browser because it looks good on your favorite one. Remember that the same browser could be used on another operating system and it may not look the same. What you need to do now is to check your page on every possible combination of OS and browser.

Use Log Files

Including log files can be very tiresome, however, it can also be very useful. It helps you know where viewers go from your homepage, what they mostly click on and what pages are least visited. Using log files can help you gather information that can help you modify your site and eventually lead your viewers to the page where you want them to go.

Don’t be afraid to recreate

One of the biggest advantages in web designing is the freedom to change web pages and layouts. Don’t be afraid to change designs that don’t work. Designing a web can be a lot of fun and involving science and structure into your designs will surely attract your viewers.

Use accurate titles for every section

Web browsers tend to scan pages and sections so make sure that your page or section titles are consistent and accurate. In this way, they can be sure that they are being led to the right section of the site.

Avoid ‘Click Here’

Links are very important in web pages. However, avoid using the text ‘click here’ when leading your viewers to another page. Instead use a descriptive and more appropriate text .

Improve Readability

Now is not the time to show off your collection of fonts. What’s important is for your customers to be able to read what is written on your site. Therefore, use attractive but readable texts to attract readers and customers of your site.

Proofread

Even the most excellent writer makes grammatical and spelling errors. You wouldn’t want your site viewers to think you’re an amateur, would you? What you have to do in order to increase trustworthiness is to proofread everything that is written in your site. Remember, less mistakes or lack of errors can add to your reliability points.

Tips on How to Write Great Blogs

The internet brings a lot of things to do for a lot of people. Thanks to the internet, people from different parts f the world will now be able to communicate and interact with each other for free. One way to reach out to people is through blogs. In fact, blogging brings fame and even can let you earn extra cash if you’re good enough.

Basically, blogging was originally created as an online journal or diary where people are able to express their feelings and let other people know about it through the internet. Today, blogging is now considered to be one of the most popular ways for people to interact with each other and share their point of view about different kinds of things.

From life experiences, to trying a particular product, blogging can definitely make you famous.

So, how can you become famous through blogging and how can you take advantage of your blogging website that it can generate you some extra cash?

First of all, you have to remember that blogging is all about writing. It’s like writing a novel where you need to get people hooked into reading it. The great thing about blogging is that once people like what they read, they will often recommend it to their friends and so on. This is how you basically get famous through blogging.

You can also try posting in forums and on article publishing websites where at the end of each post, you will put in a link to the website where your blogs can be accessed.

Once you get loyal readers, you can start earning some cash. Depending on the subject of your blogs, you can become an affiliate marketer where you will include links of affiliate companies in your blogs. You can also make money by selling merchandises. For example, you can sell T-shirts, coffee cups, and other stuff.

In order to become famous, you need to write blogs that people will want to read. If you are going to talk about your life experiences, focus on one subject. For example, if you love the outdoors, try writing your experiences about it and don’t be afraid to bend reality and fiction. You can always mix both. It is also a good idea to mix in some sarcastic humor that people will surely love reading even if they get a bit offended.

The key to writing good blogs is by getting people’s attention on the first sentence. Once you get their attention, then the rest of the blog you write should be able to keep them reading. Never go from one subject to another. When writing blogs, you need to be consistent and everything you write should be relevant.

Once you get people to read your blogs and if they really like what they read, they will often recommend it to their friends. All you need to do is sit back and watch it spread like wild fire. However, you have to remember that once you get loyal readers, they will keep on demanding more from you. Try to update your blog site in order for you to keep your readers loyal and excited.

As you can see, blogging brings fame. If you want to be known in the internet, then blogging is the best way to get people’s attention. However, you should always remember that one should write good blogs in order for it to last.

Web Design Articles – Web Designing Tips

Mouseovers first became technically feasible with the release of Netscape Navigator 2.0, which included a new scripting language called JavaScript. The idea was to allow the Web to transcend for the first time the basic functionality of HTML. As standards in this area converge, the use of scripting on the Web is becoming more feasible. The swell in popularity of the script-powered mouseover (as opposed to the comparatively slow and lazy Java implementations that were popular for a brief time) is a testament to the usefulness of JavaScript and its kin.

The Image Object

Frankly speaking, you don’t need to be an expert with JavaScript to understand this article, as everything is explained from the ground up.

In most respects, JavaScript is an object-oriented language, which means that in the world of JavaScript, everything is an object. A browser window is an object (referred to as the window), a Web page is an object (the document) and the images in the Web page are objects in their own right. The nice thing about objects is that they have properties that you can change.

If you are familiar with the basics of HTML, you’ll be used to the concept that you can create an image object on a Web page using the tag:

Now, without knowing it, when you type this, you automatically create a JavaScript image object, which will allow you to change its properties later on if you like. This is exactly what we want to follow to create a mouseover. When the mouse moves over the image we want to change what the image looks like, and what the image looks like is a property of the image object.

To simplify referring to this particular image object later on, we can assign it a name. This is pretty easy to do, and just requires us adding the NAME attribute to our tag.

Now our image object is named “myimage”, and can be referred to as such. At this point, it’s worth pointing out that JavaScript is largely case sensitive. In other words, our image named “myimage” cannot be referred to as “MYIMAGE” or “MyImage”.

You are aware that objects in JavaScript have properties that we can change. We can set a property of our “myimage” object with the following general JavaScript statement:

document.images["myimage"].property = newvalue;

Where property is the name of the property you want to change and new value is the new value you are assigning it. This line can be read:

“In the current document, in the image called “myimage”, set property to newvalue.”

You must be wondering to know how to apply this to the mouseover. Well in a mouseover, we change the image displayed by the image object. Just as in HTML, where we use the SRC attribute of the tag to indicate the URL of the image file we want to display, in JavaScript we set the src property of the image object to the URL of the image file we want it to display.

Using the general JavaScript statement as mentioned above, this is written simply:

document.images["myimage"].src = “newimage.gif”;

How Mouseovers Work

Now that you know how to change an image’s appearance using JavaScript, we need to figure out how to do this when the user places the cursor over the image. Also, we need to know how to switch it back again when the user’s mouse isn’t over the image anymore. The feature of JavaScript that allows us to do this is called event handlers.

Event handlers can be thought of as “triggers” that cause things to happen when a certain condition is met. The two event handlers that interest us when it comes to Mouseovers are onMouseOver and onMouseOut. These allow you to define certain pieces of JavaScript to be run whenever the user’s mouse hovers over or passes out of a given HTML element.

While the HTML 4.01 specification says that we should be able to define onMouseOver and onMouseOut event handlers for any HTML element, Netscape Navigator falls a bit short by only providing this facility for the anchor reference.

 

This creates a link that does nothing (void) when clicked. If you did want it to link to something, you’d just stick your URL in the place of javascript:void(0). To add our event handlers is as simple as inserting them as attributes to the tag:


In the above, overmyimage() and outmyimage() are JavaScript functions that handle changing the image between the “on” and “off” states. A function is a piece of JavaScript that has been set aside to be “triggered” at some later time. In most cases, functions are defined in the header of your HTML file (between the and tags). Our overmyimage() function would look something like this:

We would insert the code that’s to be run whenever this function is called (triggered) at the place we have indicated.

Now, armed with a basic knowledge of the image object, event handlers, and functions, we are now ready to create…

Our First Mouseover

If you’ve been following closely and fully understand the elements we have covered so far, their assembly into a working mouseover should be quite easy. Now just follow the simple steps to achieve this.

First, let’s start by creating our image. It will be 70 pixels wide and 30 pixels high, and the filename for the “inactive” image will be “off.gif”. We do this just as we would normally, using the HTML tag. We’ll also use the NAME attribute to assign it the name “my1stMouseOver”.

Now we’ll add a “link to nowhere” around our image, so that we can hook in onMouseOver and onMouseOut event handlers, set to trigger JavaScript functions that “activate” and “deactivate” the image. Appropriately enough, we will call these functions activate() and deactivate().


Now all that’s left is to write the JavaScript functions, activate() and deactivate(). The activate() function will change the src property of the “my1stMouseOver” to the “active” image file, which we’ll call “on.gif”.

function activate() {
document.images["my1stMouseOver"].src = “on.gif”;
}

Similarly, the deactivate() function will change the src property of the “my1stMouseOver” back to the “inactive” image file, “off.gif”.

function deactivate() {
document.images["my1stMouseOver"].src = “off.gif”;
}

And that’s it! We’ve now created an image that displays “off.gif”, except when the user places the mouse pointer over it, at which time it changes to display “on.gif”. When the user moves the mouse away again, it goes back to displaying “off.gif”.

In the following sections, we’ll take the basic mouseover that we created in the last section and add a couple of bells and whistles that will improve its expandability and performance. Overall, these are good skills to know if you’re going to be making serious use of mouseovers in the pages you design.

Sharing Functions

In our basic mouseover, we used one tag and two JavaScript functions to obtain the effect we were looking for, but on a page with 5 mouseovers, that would mean having to write 10 different functions (not to mention coming up with 10 different names for them!). What if there was a way to use the same two functions for all the mouseovers on your page?

As it turns out, this is surprisingly easy to do. First, we must create JavaScript variables that contain the filename of each mouseover’s “on” and “off” image. If, for example, we had created a page with three tags that we wanted to be mouseovers, and we’d named these images “first”, “second” and “third” using the NAME attribute of the tag, we would create variables with names of the form name_on and name_off, like this:

var first_off = “image1off.gif”;
var first_on = “image1on.gif”;
var second_off = “image2off.gif”;
var second_on = “image2on.gif”;
var third_off = “image3off.gif”;
var third_on = “image3on.gif”;

The next thing we have to do is set up the onMouseOver and onMouseOut event handlers to pass the name of the image to change to our functions. For example, the code for our “second” Mouseover would look like this:


Notice that the argument (the text to be passed to the function) is surrounded by single quotes (‘). This is so that they don’t interfere with the double quotes (“) that surround the event handler.

By passing the name of the image to be changed, to our ‘activate’ and ‘deactivate’ functions, we give them a way to know which image to change when they’re triggered. This is how we manage to share the two functions between as many mouseovers as we want. All that’s left is to modify these functions to receive this image name, and use it to modify the correct image.

The code for our new functions will look like this:

function activate(imgName) {
document.images[imgName].src = eval( imgName + “_on” );
}

function deactivate(imgName) {
document.images[imgName].src = eval( imgName + “_off” );
}

By placing the word imgName between the parentheses that follow the name of the functions, we tell them to accept a value that’s being passed to them (in this case, the name of the image to change), and stick it into a variable called imgName until we finish processing the function. We then make use of this variable in two places. First, we use it to indicate which image object who’s src property we want to change (images[imgName]). Second, we use it to refer to the variable that contains the correct filename. This is done using the eval(…) built-in function.

eval( imgName + “_on” )

All this does is takes the value of the imgName variable, sticks it together with the piece of text “_on” and then evaluates the result as if it were a normal piece of JavaScript code. To make this as clear as possible, let’s go through what would happen if the onMouseOver event handler were triggered on the image named “third”.

When the onMouseOver event handler is triggered, it runs the activate function, and passes it the name of the image — “third”. The function accepts this argument, and places “third” wherever the variable imgName appears.

function activate(“third”) {
document.images["third"].src = eval( “third” + “_on” );
}

The eval(…) built-in function sticks the two strings it has together (as indicated by the ‘+’ operator) and then evaluates it as if it were a normal piece of JavaScript:

document.images["third"].src = third_on;

Now third_on is the name of the variable containing the “on” image filename for the “third” image, so its value is substituted in:

document.images["third"].src = “image3on.gif”;

And that’s it — we’re left with a statement of the same form we used for our basic mouseover, which will change the src property of the “third” image to “image3on.gif”! The key was in naming the variables that contained the filenames so that the eval(…) function could come up with the variable name by just tacking “_on” or “_off” onto the end of the name of the image.

Preloading Images

Most Web browsers these days are pretty smart. When they load something, they put it into a cache on your system where it will remain for a little while for quick and easy access in case it’s needed again. Most browsers aren’t smart enough to load things ahead of time, though. In most cases, this isn’t a big problem, but when it comes to mouseovers it can be trying at times!

When a user places the cursor over one of your mouseovers, the Web browser will realize it needs to display the “on” image. If this is the first time this user accesses your site, chances are that image isn’t in the cache, and must be loaded from your site. This causes a delay that can often be longer that it takes for the user to have moved the mouse back off the mouseover, having never seen that pretty light-up button you’d planned to display. Worse, if the “on” image is only partially loaded, the user may see a horrible, blurry mess in the place of the slick image you’d planned.

How do we overcome this problem? The solution is to preload the images required by the mouseover into the user’s cache so that we can be sure they’re available before we attempt to display them. To do this, we must make creative use of the JavaScript image object.

Up until now, we’ve only created image objects with the standard HTML tag. We can, however, create them using only JavaScript. Such JavaScript-only image objects do not display on the Web page, but they do load and cache and they have the same properties as an image object created with HTML. The strategy, then, is to create JavaScript-only image objects for every one of the image files to be used in your mouseovers. To do this for our example of the three mouseovers used in the previous section, we can replace our variable declarations with the following image declarations:

var first_off = new Image();
first_off.src = “off1.gif”;
var first_on = new Image();
first_on.src = “on1.gif”;

var second_off = new Image();
second_off.src = “off2.gif”;
var second_on = new Image();
second_on.src = “on2.gif”;
var third_off = new Image();
third_off.src = “off3.gif”;
var third_on = new Image();
third_on.src = “on3.gif”;

For each image file, we create a new image object, and then set its src attribute to the appropriate filename. In setting this property, the browser decides it needs to download the image file, at which point it is stored in the cache for quick retrieval when it is actually needed for display. We obey the same naming convention for the image objects as we did for the filename variables in the previous section.

Now all that’s left is to adjust our ‘activate’ and ‘deactivate’ functions once again so that they use the values of the src properties of the JavaScript (only image objects instead of the values of the variables.)

function activate(imgName) {
document.images[imgName].src = eval( imgName + “_on.src” );
}

function deactivate(imgName) {
document.images[imgName].src = eval( imgName + “_off.src” );
}

Finally, we can make one more adjustment to make doubly sure that the user never sees a half-loaded image. Although this preloading technique does load the mouseover images ahead of time, it is still possible for the user to trigger a mouseover before the images have completely loaded. To guard against this, we put a little “valve” in the ‘activate’ and ‘deactivate’ functions:

function activate(imgName) {
if ( eval(imgName + “_on.complete”) ) {
document.images[imgName].src = eval( imgName + “_on.src” );
}
}

function deactivate(imgName) {
if ( eval(imgName + “_off.complete”) ) {
document.images[imgName].src = eval( imgName + “_off.src” );
}
}

This makes use of another property of the JavaScript image object. We already know the src property contains the URL of the image file it represents. Here we use the complete property, which is true if the image has completed loading, and false if it has not. These newly-modified versions of activate and deactivate only change the displayed image if the JavaScript-only image object responsible for preloading the new image is complete.

Advanced Techniques

Finally, this section will show you a simple way to make sure your mouseover pages are compatible with older browsers, as well as a neat trick to prevent preloading mouseover images from slowing down the rest of your page.

Browser Compatibility with Object Detection

Now that you know all about how to make mouseovers that work well, it’s worth taking a moment to learn how to make ones that don’t work just as well. While mouseovers of the type I’ve outlined up until now will work consistently on all recent JavaScript-enabled browsers (Netscape 3+, as well as MSIE 4+), there are some browsers that support JavaScript, but don’t fully support the image object.

One such browser is Microsoft Internet Explorer 3.0. If we were to load a page that contained mouseovers with the code I’ve used up until now on MSIE 3.0, we’d see a lot of ugly JavaScript errors. Since we can’t do Mouseovers on this browser, the least we can do is getting rid of the error messages.

While there are several ways to detect the version of the user’s browser in JavaScript and react accordingly, such techniques can sometimes prove unpredictable in the face of less mainstream Web browsers. Also, whenever either Netscape or Microsoft release a new version of their browser software, any page using such browser detection scripts would need to be updated.

Much more reliable and efficient is a little-known technique called object detection. The idea is that, instead of detecting the version of the browser, we detect the features that the browser supports. As any browser that supports the image object will be capable of mouseovers, we need only detect whether or not the browser knows what image objects are before we do anything that requires support for them. This is done with a simple if statement:

if (document.images) {
… code here …
}

Which can be read:

“If the current document contains images then do the following…”

If we add an if (document.images) to the activate and deactivate functions, and place one around the image declarations, we’ll have mouseovers that quietly disappear on browsers that don’t support the image object.

Delaying Image Loading

Preloading images is all well and good, but what if you have 20 mouseovers on a given page? Do you really want to have the browser busy downloading 20 images before it even gets to start loading the actual content of the page? Obviously not. A nice way around this is to use the on Load event handler of the tag to trigger a function that loads the mouseover images only after the HTML code for the page has been loaded. This way, all the images actually displayed on the page are put ahead of the mouseover images in the download order.

The use of onLoad is fairly straightforward:

All that’s left is to put the preloading of the mouseover images inside the loadImages() function.

if (document.images) {
var first_off = new Image();
var first_on = new Image();

var second_off = new Image();
var second_on = new Image();

var third_off = new Image();
var third_on = new Image();
}

function loadImages() {
if (document.images) {
first_off.src = “off1.gif”;
first_on.src = “on1.gif”;

second_off.src = “off2.gif”;
second_on.src = “on2.gif”;

third_off.src = “off3.gif”;
third_on.src = “on3.gif”;
}
}

The point worth observing here is that we have left the creation of the JavaScript-only image objects outside the loadImages() function. This is done for two reasons. First, the creation of the objects doesn’t load any files: only the setting of the src properties does that, so leaving the object declarations outside the function won’t slow down the loading of the rest of the page. Second, objects or variables that are created inside a function only exist inside that function. If we were to move the creation of the image objects inside the function, they would disappear as soon as the function finished running, and the ‘activate’ and ‘deactivate’ functions would no longer be able to use them.

That’s it! Now our mouseover images will only be loaded when the on Load event handler of the tag is triggered, and this only happens once the HTML code for the whole page has been loaded, and any images on that page have started loading. Whether this is desirable or not is up to you to judge, but it can be a good idea in cases where there are a lot of mouseovers on a page and their being immediately available is not that important.

The Essence:

In this article we have tried to throw enough light on the techniques involved in making Web page elements respond to the movement of the user’s mouse. Not only did we cover the basics in terms that, hopefully, were accessible to anyone with a superficial knowledge of Web design and general programming, but we also covered some more advanced topics that would prove useful to the more experienced Web developer.

Tags

web design articles reply--