When the user that is currently visiting the site such as this site the following Javascript
will make the user stay on the web page by giving a message to how long they visited the particular web site as well as opening
a new window.
We have mainly placed this script on Computer Hope to look at the source code for ideas for
other possible Javascript and do not recommend anyone placing this script on their pages as this irritates the viewers of
your web pages.
In addition we have placed as an example this code into this page and for you to do the same
you must include this into the beginning of your web page within your head statements as well as ending the page once completed
with the </body>
SOURCE CODE
<head><script language="JavaScript">
// This script was written by Kurt A> //http://www.geocities.com/soho/lofts/1238 //
I only ask that you leave this plug to my page if you use the script. // It worked for me, If it works for anyone else
----- I can't say. // It times the user for a page and gives a response dependant on the // duration of the visit to
the page. // It doesn't work well with the #links because anytime a back button //is hit the script will envoke itself.
} // -- End of JavaScript code -------------- --> </SCRIPT> <BODY
onLoad="setbackground();">
-------------------------------------------------
SOURCE CODE
<script language = "JavaScript"> <!-- Begin hiding here --
//************************************************************************** //*
this script by Jason Schanker (jcheetah@orion.webspan.net) * // * comes from * // * "http://www.webspan.net/~herbs/jcheetah/web_design/javascript/bgcolor_changer.html"*
// * You may copy this source freely if credit is given to the author * //**************************************************************************
// -- End hiding here --> </script> <h1><center>Welcome To The Twilight
Zone</h1></center> <form name = control> <input name = "on_off" type = "button" value = "On" onClick
= "color_changer()"> <input type = "button" value = "Off" onClick = "history.go(0)"> </form> <p>
Before this page loaded you should have seen a multitude of colors this would be what it would
look like, hit refresh if you would like to see it again.
Important: Ensure if you have a body statement within your HTML code
that the following script is placed after it and that the original body script does not have a background statement.
SOURCE CODE
<script> function initArray() { this.length = initArray.arguments.length for
(var i = 0; i < this.length; i++) this[i+1] = initArray.arguments[i] }
var hexChars = "0123456789ABCDEF";
function
Dec2Hex (Dec) { var a = Dec % 16; var b = (Dec - a)/16; hex = "" + hexChars.charAt(b) + hexChars.charAt(a); return
hex; }
</script> <script> <!--
// black to black (pause) bgChanger("000000","000000",25); // black to red bgChanger("000000","FF0000",25); //
red to black bgChanger("FF0000","000000",25); // black to purple bgChanger("000000","AA00EE",25); // purple to
black bgChanger("AA00EE","000000",25); // black to blue bgChanger("000000","0000FF",25); // blue to black bgChanger("0000FF","000000",25); //
black to white (pause) bgChanger("000000","FFFFFF",25); // --></script>
ALLOW VISITORS TO SEE HISTORY OF VISITING YOUR PAGE
EXAMPLE
Allows your visitors to see really how addicted they are to your web page. Information is
stored on there hard drive with a cookie and each time they come back it will refer to the cookie and count up upon visit.
<SCRIPT LANGUAGE = "JavaScript"> <!-- Begin Script /* ----------------------------------------- |
By Mattias Sjöberg 9/10-96 | |You're welcome to use/edit this script.| | Keep the comments and drop me a note. | ----------------------------------------- |
mattias.sjoberg@swipnet.se | | www.geocities.com/SiliconValley/7116 | | Vote for my page at the above URL | ----------------------------------------- */ var
expDays = 30; var exp = new Date(); exp.setTime(exp.getTime() + (expDays*24*60*60*1000));
function Who(info){ //
Who var VisitorName = GetCookie('VisitorName') if (VisitorName == null) { VisitorName = prompt("Who are you?"); SetCookie
('VisitorName', VisitorName, exp); }
return VisitorName; }
function When(info){ // When var rightNow
= new Date() var WWHTime = 0; WWHTime = GetCookie('WWhenH')
WWHTime = WWHTime * 1 /*This part is written by
Cut & Paste JavaScript Copyright 1996, IMA STUDIOS, Inc. This code may not be resold. This Copyright notice
must be included on every document that contains this code. A link to http://www.imastudios.com should be included
somewhere on your document. */ var lastHereFormatting = new Date(WWHTime); // Date-i-fy that number var intLastVisit
= (lastHereFormatting.getYear() * 10000)+(lastHereFormatting.getMonth() * 100) + lastHereFormatting.getDate() var lastHereInDateFormat
= "" + lastHereFormatting; // Gotta use substring functions var dayOfWeek = lastHereInDateFormat.substring(0,3) var
dateMonth = lastHereInDateFormat.substring(4,11) var timeOfDay = lastHereInDateFormat.substring(11,16) var year = lastHereInDateFormat.substring(23,25) var
WWHText = dayOfWeek + ", " + dateMonth + " at " + timeOfDay // display
SetCookie ("WWhenH", rightNow.getTime(),
exp)
return WWHText; }
function Count(info){ var psj=0; // How many times var WWHCount = GetCookie('WWHCount') if
(WWHCount == null) { WWHCount = 0; } else{ WWHCount++; } SetCookie ('WWHCount', WWHCount, exp);
return
WWHCount; }
function set(){ VisitorName = prompt("Who are you?"); SetCookie ('VisitorName', VisitorName,
exp); SetCookie ('WWHCount', 0, exp); SetCookie ('WWhenH', 0, exp); }
// ********************* General Cookie
handling ********************* // Cookie Functions - Second Helping (21-Jan-96) // Written by: Bill Dortch, hIdaho Design
<bdortch@netw.com> // The following functions are released to the public domain.
function getCookieVal (offset)
{ var endstr = document.cookie.indexOf (";", offset); if (endstr == -1) endstr = document.cookie.length; return
unescape(document.cookie.substring(offset, endstr)); }
function GetCookie (name) { var arg = name + "="; var
alen = arg.length; var clen = document.cookie.length; var i = 0; while (i < clen) { var j = i + alen; if
(document.cookie.substring(i, j) == arg) return getCookieVal (j); i = document.cookie.indexOf(" ", i) + 1; if
(i == 0) break; } return null; }
function
DeleteCookie (name) { var exp = new Date(); exp.setTime (exp.getTime() - 1); // This cookie is history var
cval = GetCookie (name); document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
} // End Script
-->
</SCRIPT>
<script> document.write("Hello <b>" + Who() + "</b>. You've been
here <b>" + Count() + "</b> time(s). Last time was <b>" + When() +"</b>.") </script> <br> <a
href="JavaScript:set()">Change name</a>
"Few things are harder to put up with than the annoyance of a good example."
-- Mark Twain
SOURCE CODE
<SCRIPT LANGUAGE="JavaScript"> //store the quotations in arrays quotes = new Array(6); authors
= new Array(6); quotes[0] = "I have a new philosophy. I'm only going to dread one day at a time."; authors[0] = "Charles
Schulz"; quotes[1] = "Reality is the leading cause of stress for those in touch with it."; authors[1] = "Jack Wagner"; quotes[2]
= "Few things are harder to put up with than the annoyance of a good example."; authors[2] = "Mark Twain"; quotes[3]
= "The pure and simple truth is rarely pure and never simple."; authors[3] = "Oscar Wilde"; quotes[4] = "There's no
business like show business, but there are several businesses like accounting."; authors[4] = "David Letterman"; quotes[5]
= "Man invented language to satisfy his deep need to complain."; authors[5] = "Lily Tomlin";
//calculate a random
index index = Math.floor(Math.random() * quotes.length);
As shown when the page opened. This script will encounter issues if placed on the same page
as the destination page (such as we have done on this page). When implementing this we recommend you place this on a page
of its own and direct the correct password users to another page.
Keep in mind that this password is not a recommended method for sites that need to be 100%
secure as experienced users can easily bypass this.
If you are looking for a 100% secure method of implementing passwords you will need to create
a .htaccess file on the server containing the security information. Additional information on how to do this can be found
through your ISP (if supported).
SOURCE CODE
<script language="Javascript">
<!--
var password = "please" var x = prompt("Enter in the password "," ") if (x.toLowerCase()
== password) { alert("Come right in \n \n You've entered in the right password") location = "index.htm" }
else { location = "bad.htm" }
//-->
</script>
-------------------------------------------
MOUSE OVER PROMPT
This allows you to prompt the person when there mouse is over a particular link or picture,
great for letting someone know what a picture is, if the image is small.
Source:
<CENTER><TABLE WIDTH="40%"><TR><TD><A HREF="" ONMOUSEOVER
= "alert('Welcome to ComputerHope')")> <IMG SRC="title.gif" BORDER="0" WIDTH="134" HEIGHT="64"></A></TD> <TD
ALIGN=RIGHT><A HREF="" ONMOUSEOVER = "alert('Produced by Computer Hope')")> Who is responsible?</A></TD></TR></TABLE></CENTER>
This allows the person viewing your page to prompt them self, we really could think
of anything that this could be used for except for the person to talk to them self however kind of cool.
Here are some cool tricks you can use on your
site. They use various languages such as CSS, Javascript, and even just plain HTML. Remember that although they may seem pretty
cool to you, not everyone is using a browser that can see these tricks. In other words, have fun with them, but don't rely
on them to work for everyone.
Non-underlined Links This is quite easy, and looks very professional when used correctly. Add the following code
between your </TITLE> and </HEAD> tags:
How do I make HTML code viewable? What happens when you want to make HTML code visible to someone visiting your
page? For instance, let's say that you wanted to show your visitors the code to center text. You can't just type this:
<CENTER>My favorite TV show is South Park.</CENTER>
If you type that,
your result will be "My favorite TV show is South Park." actually centered. The code in the brackets will not be visible to
your visitor at all. To make it visible, you'll have to use ASCII character codes. I know, it sounds scary, but it's really
quite easy. Here's the code:
<CENTER>My favorite TV show is South Park.</CENTER>
<
is the ASCII code for the left angle bracket, and > is the ASCII code for the right angle bracket. Use those two codes
like in the above example, and this is what you'll get:
<CENTER>My favorite TV show is South Park.</CENTER>
How do I make my links change color when I move my mouse over them? This trick looks pretty cool, but unfortunately
it only works with newer versions of MSIE, and doesn't work at all with Netscape. To add this to your page, just add the following
code to your page between the </TITLE> and </HEAD> tags:
Now,
all that's left to do is insert the color codes in place of "COLORCODE." You can find a long list of the colors you can use
here.
Note: The code here has the links non-underlined. If you want your link underlined, simply remove all instances
of "text-decoration: none;" from your code.
Mailto link with subject This one's really easy. If you can make a mailto link, you can make this. I'll just
give you an example.
Regular mailto link:
<a href="mailto:billg@microsoft.com">Email Billy Boy</a>
Mailto link
with subject:
<a href="mailto:billg@microsoft.com?Subject=Heya">Email Billy Boy</a>
Icon for your site's bookmark in IE5 (favicon.ico) There's a new feature in IE5 that lets webmasters create a
small 16x16 icon for their website that will appear right to the left of your site's title in IE5's Favorites list. It's not
mandatory, but it's pretty cool to have. To make an icon for your site, download some icon creation software from Download.com (there's tons of it there) or use the java-based icon creator at favicon.com. Make sure it is saved as favicon.ico and upload it to every directory in your site that contains HTML files.
Page Transitions Transitions are a nice, fun little novelty that not too many people know about. This is done
by adding a simple META tag between the and tags instead of using Javascript or something of that nature, so it's not that
much of a pain to your visitors. Transitions can only be seen if you're using a later version of Internet Explorer. The tag
structure is like this:
Where it says "Duration=3", this is where you specify how long you want the transition to last. With the 3 there, it is
set to last 3 seconds. Where it says "Transition=0", replace the zero with the number of the transition you'd like to use.
I've made a list of transitions below with thier numbers. Click on the name of a transition to see an example of it.