Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Java Code


  • Please log in to reply

#1
robertmacelvain

robertmacelvain

    New Member

  • Member
  • Pip
  • 1 posts
I want to find a Java Genius who can figure out how to download the following URL:

http://www.sylloge.com/5k/entries/162/

so that a few small alterations can be made to the Source Code.

Edited by Metallica, 21 January 2008 - 04:18 AM.
mailaddress removed

  • 0

Advertisements


#2
sumguy

sumguy

    Member

  • Member
  • PipPip
  • 54 posts
.... umm its not even java...its script.
  • 0

#3
Metallica

Metallica

    Spyware Veteran

  • GeekU Moderator
  • 32,978 posts
Just the javascript? It consist of three parts.

The race:

<!--
tLen=43; // track len
var rYes; var rNo;
var abort = ".. and now we will never know";

var goY = null; var goN = null; var tY = false; var tN = false;

yAr = new Array(); nAr = new Array();
yAr[0] = 4;yAr[1] = yAr[0] + tLen-1;
nAr[0] = yAr[1] + 3;nAr[1] = nAr[0] + tLen-1;

if(document.images) {im = document.images;
var end = new Image(20,12); end.src = "bdot.gif";
var rcer = new Image(20,12); rcer.src = "bug.gif";
var O = new Image(20,12); O.src = "blank.gif"; }

function moveY() {
if(goN && goY) {
goY = StopClock(tY,goY);
ranS= Math.floor(Math.random()*900) + 100;
im[rYes].src = O.src; 
rYes++;
im[rYes].src = rcer.src;
if(rYes > yAr[1]) endRace("yes");
tY = setTimeout("moveY()",ranS);
goY = true;
}
}

function moveN() {
if(goN && goY) {
goN = StopClock(tN,goN);
ranS= Math.floor(Math.random()*900) + 100;
im[rNo].src = O.src;
rNo++;
im[rNo].src = rcer.src;
if(rNo > nAr[1]) endRace("no");
tN = setTimeout("moveN()",ranS);
goN = true;	}
}

function endRace(a) {
if (goY) clearTimeout(tY); goY=false;
if (goN) clearTimeout(tN); goN=false;
if(a != abort) eval("im." + a + ".src = '" + a + ".gif'");
else alert(abort);
}

function resetT() {
if(document.images) {
im[rYes].src = O.src; im[rNo].src = O.src;
im[yAr[1]+1].src = end.src; im[nAr[1]+1].src = end.src

im["yes"].src = O.src; im["no"].src = O.src
rYes = yAr[0]; rNo =  nAr[0];
placeRs();}
else alert("aborting, please use NN3+, IE4+ or similar"); 
}

function placeRs() {im[rYes].src = rcer.src; im[rNo].src = rcer.src}
function StopClock(tID,tgo) { if (tgo) clearTimeout(tID);tgo=false}
function StartClock () {resetT(); goN=true; goY=true;start = Math.round(Math.random()) <1 ? setTimeout("moveY();  moveN()", 200) : setTimeout("moveN(); moveY()", 200)}
// -->

<!-- 
if(document.images) {strAr = "<nobr>";
for (t=0;t<=tLen;t++) 	strAr +='<img src="' + O.src + '" width=12 height=12 border=1 hspace=1 vspace=1>';
retStr = "</nobr><br clear='all'><nobr>";
retStr +='<img src="yes.gif" width=20 height=12 border=0 alt="" vspace=1>' + strAr +  '<br><img src="no.gif" width=20 height=12 border=0 alt="" vspace=1>' + strAr + '</nobr>';
document.write(retStr)} // -->
and the button to start and the link to stop the race
<h2><a href="java script: StartClock()">Start</a>&nbsp;<input type="button" value="&raquo;" onClick="if(document.images) StartClock()"></h2>

<a href="java script: endRace(abort)">[stop]</a>

  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP