I suck at the internet :(
December 14, 2005 7:00 AM   Subscribe

I need some javascript/php coding help, can anyone help?

Does anyone know how to go about getting something like what's on this page onto my own page? I have no idea how to make this happen. I have viewed the source, and really come up with nothing more than downloading the .js file that fades the words in and out.
I have tried to contact the guy who runs the site, to no avail. Any one know how to do that, or point me to a similar script, with instructions?
posted by deadmouse to Computers & Internet (6 answers total)
Response by poster: By "what's on this page" I mean the entry form where people can enter something, then it displays the last 30 things at the top of the page, fading them in and out.
posted by deadmouse at 7:02 AM on December 14, 2005

While viewing the source you will see that all of the fading things are stored in a big array, and that array is then accessed by the methods in the included rumorfader.js file. If you look through that file you'll see what's going on.

Basically, this is what happens:

1. the main page has the following in the body tag:
body onload="fadeRumor();"

2. the fadeRumor() function in the included JS file is then called. It does the following (I've added comments so you can understand):
function fadeRumor() {
	if (indexRumor >= fcontentRumor.length) indexRumor = 0; //if the next cell in the array is larger than the array (off the end, no rumors there), reset the index to the beginning
	if (DOM2Rumor) { //DOM2Rumor = document.getElementById, which basically just means (if this stuff will work, do it -- if not, don't even try)		
document.getElementById("fscrollerRumor").innerHTML=begintagRumor+fcontentRumor[indexRumor]+closetagRumor; //set the text inside the rumor area to the new rumor
		indexRumor++; //set up the next rumor in the array for the next time we through the loop
		colorfadeRumor(); //fade the text into view.
	} else if (ie4Rumor) {  //the same stuff, but for an old, crappy browser		
		indexRumor++;		setTimeout("fadeRumor()",Math.min(delayRumor,2500));
	} else if (ns4Rumor) {//the same stuff, but for an old, crappy browser

It looks like colorfadeRumor(), the function that fades the actual rumor text, just changes the color on the words until they match the background, then switches rumors, then changes the colors again until they are clearly visible. They could have done this an easier way by just drawing a covering div over the top of the text and adjusting the opaqueness, but I guess this is less processor intensive, really.

Sorry for the awful formatting.
posted by ducksauce at 7:49 AM on December 14, 2005

You could do it with a simple text file, but that would run into concurrency issues eventually. Do you have access to a database?
posted by Leon at 7:55 AM on December 14, 2005

Hmm. I think ducksauce and I are answering different questions. Just to be clear, do you want help with the fading, or do you want help with accepting text strings, storing the last 30, displaying them on your site?
posted by Leon at 8:00 AM on December 14, 2005

Leon, reading the post and the first comment, the answer is apparently all of the above.
posted by scottreynen at 8:14 AM on December 14, 2005

Response by poster: the fading is not really neccessary, but cool. what i am most interested in is how do i go about creating a form where people can input there text, then have it displayed randomly. ducksauce, if you might email me, i think you could help me out greatly. and yes, i have database access, but just a little exp. with them.

thanks for the replies!
posted by deadmouse at 2:50 PM on December 14, 2005

« Older Converting to XHTML?   |   Firefox Keyboard Shortcuts For Navigating Between... Newer »
This thread is closed to new comments.