Here are some HTML and JAVA codes, tips and tricks you can use with your web documents. The JAVA scripts listed here are very easy to implement, just be sure to read the instructions carefully. All of these are great for enhancing both your website and your authoring skills.
Automatically Redirect Surfer
Keep in mind that the following will not work with very old versions of Netscape and/or Explorer. Place the following code in between your <HEAD> tags.
<HEAD>
<META HTTP-EQUIV=REFRESH CONTENT="5;URL=http://www.Url_Of_Your_Choice.com;>
</HEAD>
CONTENT="5 is the number of seconds the browser will wait before redirecting to the specified URL. The count starts once the page is fully loaded.
Pop-Up Question Prompt
When someone comes to your page they will be asked a designated question. If they answer OK, they will be sent to the page of your choice.
Just Copy and Paste the code below between the <HEAD> and </HEAD> tags.
<script LANGUAGE="JavaScript">
self.blur();
self.moveTo(0,0)
self.resizeTo(screen.availWidth,screen.availHeight)
if (confirm("INSERT YOUR TEXT HERE"))
{window.open('http://www.SITE_OF_YOUR_CHOICE.com', 'Vote');}
</script>
Add To Favorites Button
Copy and Paste the following code into your HTML document to create an "Add To Favorites" button. This will enable your visitors to add your site to their favorites with one click. Please note that it will only work with Internet Explorer users. Udpate the code with your website URL and PERSONAL text.
<script language="JavaScript">
function bookmark(){window.external.AddFavorite('http://www.YOUR_SITE.com','YOUR_TEXT');}
</script>
<form><INPUT TYPE="BUTTON" VALUE="Add This Page To
Your Favorites" onClick="bookmark()">
</form>
Open Link In A New Window
Display Current Date
Put the current date on your page for visitors to see. The date will be current as long as the viewer has the proper date on his computer and will update itself everyday. Simply copy and paste this code into your HTML document:
<script LANGUAGE="JavaScript"><!--
function makeArray() {var args = makeArray.arguments;for (var i = 0; i < args.length; i++) {this[i] = args[i];}
this.length = args.length;}
function fixDate(date) {var base = new Date(0);var skew = base.getTime();if (skew > 0)date.setTime(date.getTime() - skew);}
function getString(date)
{var months = new makeArray("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
return months[date.getMonth()] + " " + date.getDate() + ", " + date.getYear();}
var cur = new Date(); fixDate(cur); var str = getString(cur);
document.write(str);
// --></script>
Create A Pop-Up Alert Message
Add Sound To Your Web Pages
There are two different tags you can use to add sound that will instantly play once a visitor comes to your page. One of the tags works only with Explorer and the other with Netscape.
The tag you can you use with Explorer is <BGSOUND>
Here is how you can use the tag:
<BGSOUND SRC=Your_File.mid LOOP=1>
The tag you can you use with Netscape is <EMBED>
Here is how you can use the tag:
<EMBED SRC=Your_File.mid AUTOSTART=true LOOP=1>
If autostart is true the sound will play automatically, if you put false your visitor will have to click on play to hear it. You can use the following types of sound files: MIDI, WAV, AU and AIFF. The loop is the number of times you want the sound to play.
Scrolling Browser Text
This code will add a scrolling text animation to the bottom of your visitor's browser. Just copy and paste the code below, there are two parts to making this work. You need to add a little code to your <BODY> tag and another between your <BODY> and </BODY> tags. Here is what you need to add to the actual <BODY> tag:
<BODY BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" onLoad="scroll()">
Copy and paste the following code between your <BODY> and </BODY> tags:
<SCRIPT LANGUAGE="JavaScript">
<!--
timeID = 5;
stcnt = 11;
msg = "Put a text here!";
wmsg = new Array(33);
wmsg[0]=msg;
blnk = "
"; for (i=1; i<32; i++)
{
b = blnk.substring(0,i);
wmsg[i]="";
for (j=0; j<msg.length; j++)
wmsg[i]=wmsg[i]+msg.charAt(j)+b;
}
function scroll()
{
if (stcnt > -1) str = wmsg[stcnt]; else str = wmsg[0];
if (stcnt-- < -40) stcnt=31;
status = str;
clearTimeout(timeID);
timeID = setTimeout("scroll()",100);
}
// -->
</SCRIPT>