Kamis, 09 April 2009

HTML & JAVA



Frameset Page Loading

One of the more common problems with using frames in the building of websites is that search engines tend to index the independent pages and link to them this way. Therefore, when someone follows the link in the engine, it will be to the individual page and not to the frameset that you designed for navigation around your site. This is a real problem if the only navigation that you offer your visitors is in one frame and the content is in a different page!

This little piece of code will correct this problem by ensuring that if someone tries to link into one html page, the script will force the opening of the entire frameset. This is a very handy piece of code:







Just be sure to replace 'index.html' with whatever filename you use for your frameset declaration file.


Timed Greeting Script

Make your site intuitive. Wouldn't’t it be nice to have a greeting on your page that responds to the time of day?

This little script does just that. You can paste this into your html document in the location you would like the greeting to appear. That’s all there is to it. Now, when someone visits your site the greeting will be:

Good Morning. Welcome to my site!
Good Afternoon. Welcome to my site!
Good Evening. Welcome to my site!


(Depending on what time it is on their computer.)



MAIL FORMATTING:


Pre-formatting "mailto" entries:
Just about everyone knows how to code an email address into a Web site so that visitors can click a hyperlink to send a message. It's simple and effective and lets the user define his or her mail message without having to fill in any tedious forms. However, did you know that you can pre-assign both the subject and the body text using the mailto tag? It's really easy and can help you quickly identify messages as they come in.

As you probably know, the HTML for the mailto anchor tag is used like this: your_name@domain.com

This creates a hyperlink that, when clicked, will launch the user's default mail program with the coded address in the "to" line. Now, you can take this a step further by introducing the "Subject" variable. For example, if you want people to submit a job application, you can pre-code the subject. This is important if you get lots of mail as it will quickly let you know the subject of these messages.

So, we would code the mailto like this:
ADDRESS
Note: no spaces are allowed ... use an underscore (_)

Now, what if you wanted to pre-determine the Body Message as well? You may wish to do this if you have an offer that is always the same, such as a request for information. Let's say you're offering a free brochure. You can code the subject as "Free_Brochure" and the Body Message as "Please send me your brochure."

We code the mailto this way:
ADDRESS

There you go, now you can save your visitors some time, and save yourself the anguish of strange email inquires by pre-coding your mailto expressions.


BREAK OUT OF FRAMES:
Break out of Frames!
You may notice when you are browsing around on the internet, you click a link and the website that opens is inside of the previous website's frames.

Sometimes this is by design, other times it's due to bad coding. You can make your page break out of another site's frames by including the following tag (make sure it's in every page of your site):



This will force your webpages to appear in their own window every time.




Make a sound on mouseover.
Some of our members have been requesting a script that would generate a sound on when a visitor mouses over a link or other object on the webpage. We found this one and thought we would pass it along.


Place this code between your tags of your html page:


Place this code where you want it to appear on the page:



Once you have the code placed on your page, you can mouse over the link and see (well, hear it) in action.
If you are not hearing a sound, be sure that you have placed your sound file online, and are pointing to it in the script.

Image Protection

Browsers will read your pages pretty much the way you do. They start at the top and work their way through all the code. When they have finished reading a set of commands they will execute them. With tables, for example, all the elements have to be read and configured prior to the table being displayed. Logically, you should spare the use of tables if you don't need them.

One way to help speed up your site and its pages is to have your images already waiting on the visitor's browser ahead of time.

Try the following trick to have your page load in one step:

Place this code between your and tags:
When your code asks for the images, instead of having to go back to the server to get them, they will already be in the user's browser cache.



Keeping Page Content Up-to-Date

If your website has content that is changing on a regular basis, and you have visitors that come to your site on a regular basis, you want to ensure that your new content is visible to these visitors each time they come. Most browsers will cache webpages to speed up loading on each subsequent visit. With constantly changing content, this could be a problem for your regular visitors.

One solution is to use meta tags to prevent pages from being cached. In this way, every time someone visits your site, they will be getting the latest content delivered to their browser.





This simple line of code will tell the browser not to cache the page. This will slow down the loading of the page each time a visitor comes, but the benefit is the displaying of the fresh content.


Stopping Search Engine Spiders

We have shown in the past ways to create meta tags for your webpages. These are the tags that search engines look at to get an idea of what your page or website is about. Sometimes you have pages on your website that you don't want the engines to index.

Pages that you may wish to exclude spiders from visiting include site administration areas, personal pages or password protected areas. For such pages you can use the following Meta Tags.




This code tells the robots not to index the page and not to follow the links that are on the page.

Another form of this tag would be:



This will tell the robots to not index this page, but it is okay for them to follow the links within the page.

While the robots are supposed to obey these tags, it is important to remember that not all of them necessarily will ... :)


ADDING SOUND
Adding sound to your website is a great feature to add to any website. To add sound to your webpage, simply add the following code to the pages where you want the sound to play. Remember, adding this code to your site is different for every editor, so be patient - you will get it!




You will notice that there are several different tags inside of this code. This is to ensure that both Internet Explorer and Netscape browsers can detect and play the sound file. Do not remove any of the tags, or the functionality will disappear.

Also remember to change the name of the file from music.mid to the actual name of your music file. Also, be sure that your music file is uploaded (or transferred) to your website, and you place it in the right directory, or it will not play.
Change an image daily

Here is a cute little script that will automatically change an image that is displayed on your webpage based on the day of the week. This is a great script for displaying a “special of the day”, or just to give your page a fresh look each day. This is limited only by your imagination.

Be sure that you edit the names of the images inside of the following script, to match the names of the files you uploaded to your server - or vise versa.




Insert this script on your webpage in the location that you would like the images to appear. Yes, it is that easy!

Tired of getting junk email?
Here is a handy script that you can add to your webpage to hide your email address from email robots (harvesters). Simply modify the address, domain and extension in the script below. Then paste it into your web pages anywhere you wish to have your email address appear on the page. Email Harvesters are then unable to read your email address - saving you from spam!


Place this code where you want it to appear on the page:





Change the year Dynamically
Every year, you have to go into your web pages and edit the copyright information to reflect the New Year. Here is a handy script that will change the year on your page automatically.
Simply add this script to the bottom of your webpage and the current year will be added automatically to complete the copyright declaration.


Place this code where you want it to appear on the page:


Tidak ada komentar:

Posting Komentar