JavaScript Links:
Here are some scripts that I have picked up:
Flying Title | New Window | Message | Banner | Random Graphic
function flyingtitle(flag) {
var line1 = " First line of text";
var line2 = " Second line of text";
var line3 = " Third line of text";
var line4 = " Fourth line of text";
var outtext=line1+line2+line3+line2+line4
var out = " ";
var cj = 1;
if (flag > 150) {
flag--;
var title="flyingtitle(" + flag + ")";
timerTwo=window.setTimeout(title,150);
}
else if (flag <= 150 && flag > 0) {
for (cj=0 ; cj < flag ; cj++) {
out+=" ";
}
out+=outtext;
flag--;
var title="flyingtitle(" + flag + ")";
window.status=out;
timerTwo=window.setTimeout(title,150);
}
else if (flag <= 0) {
if (-flag < outtext.length) {
out+=outtext.substring(-flag,outtext.length);
flag--;
var title="flyingtitle(" + flag + ")";
window.status=out;
timerTwo=window.setTimeout(title,150);
}
else {
window.status=" ";
timerTwo=window.setTimeout("flyingtitle(80)",150);
}
}
}
Call: <body onload="timerONE=window.setTimeout('flyingtitle(80)',150);">
//variables
var browserName = null;
var browserVersion = null;
var client = "unknown";
//determine support for focus
browserName = navigator.appName;
browserVersion = parseInt(navigator.appVersion);
if (browserName == "Netscape" && browserVersion >= 3)
client = "canfocus";
//New Window
function newwin() {
mapping = window.open("","Chat","width=616,height=410,resizable=yes,scrollbars=no")
if (client == "canfocus") {
mapping.focus();
}
}
Call:<a href="index.html" onClick="newwin()" Target="Window Name"></a>
function message(txt){
window.status = txt;
setTimeout("remove_message()",5000);
}
function remove_message(){
window.status="";
}
Call: <a href="index.html" onMouseOver="message('message here');return true"></a>
var id,pause=0,position=0,revol=9;
function banner()
{
var i,k;
var s1 = " Welcome to the Wazi '97 Web Page!";
var s2 = " Check out the new bill board.";
var s3 = " Add your name to the Directory NOW!";
var s4 = " There is a new addition to Christy's saga.";
var s5 = " Your input needed for columns, news and information.";
var msg = s1 + s2 + s3 + s1 + s4 + s5 + s2;
var speed=5;
document.thisform.thisbanner.value=msg.substring(position,position+50);
if(position++==msg.length) {
if (revol-- < 2) return;
position=0;
}
id=setTimeout("banner()",1000/speed);
}
Call: <body onload="banner()">
<form name="thisform"><input type="text" name="thisbanner"
size="40"></form>
function RandomNumber()
{
var today = new Date();
var num= Math.abs(Math.sin(today.getTime()/1000));
return num;
}
function RandomGraphics()
{
var x = RandomNumber();
document.write("<a href='./'><img src='");
if (x > .77) { document.write("webeach.gif"); }
else if (x > .66) { document.write("strip.gif" ); }
else if (x > .55) { document.write("falls.gif" ); }
else if (x > .44) { document.write("nakni.gif" ); }
else if (x > .33) { document.write("oldman.jpg" ); }
else if (x > .22) { document.write("house.jpg" ); }
else if (x > .11) { document.write("plane.gif" ); }
else { document.write("fern.gif" ); }
document.write("' align=center></a>");
return;
}
Call: RandomGraphics();
I love this site:
http://www.javascripts.com