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:
<head> <script language="JavaScript"> if (parent.location.href == self.location.href){ window.location.href = 'index.html' } </script> </head>
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.)
<SCRIPT LANGUAGE="JavaScript"> <!-- Begin todaydate = new Date(); timeis=todaydate.getTime(); todaydate.setTime(timeis); houris = todaydate.getHours(); if (houris > 17) display = "Evening"; else if (houris >12) display = "Afternoon"; else display = "Morning"; var welcome = ("Good " + display + ". Welcome to my site!"); document.write(welcome); // End --> </script>
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: <a your_name@domain.com">href="mailto:name@domain.com">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: <a ADDRESS">href="mailto:name@domain.com?Subject=Job_Application">ADDRESS Note: no spaces are allowed ... use an underscore (_)
We code the mailto this way: <a href="mailto:name@domain.com?Subject=Brochure&Body=Please send me your brochure.">ADDRESS</A>
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.