PDA

View Full Version : Need some JavaScript HELP!


dabrowski89
12-15-2008, 11:09 AM
Ok i have this project in my school and i have to explain my project but the thing is i don't really know how to explain one thing how it work etc....


function changecolor(code) {
document.bgColor=code
}



i know it is easy for you people but i am kind of new to JavaScripting

so no hating please :)

tnowalk
12-15-2008, 03:46 PM
If you read the snippet you should be able to figure out what is going on.

This is a simple javascript function that will change the background color of the webpage.

Ex:


<a href="javascript:void(changeBGC('#000099'))">Click to change to red</a>


When someone clicks the link it sends a variable named 'code' containing '#FF3333' to the changecolor function which then changes the current documents background color.

I suggest doing a google search for javascript tutorials, dive in and start learning.

If you have any questions pm me!
Trevor

Vege
12-16-2008, 05:39 PM
School projects are for you to learn. Copypaste will give you nothing in the long run.

coothead
12-16-2008, 06:05 PM
Copypaste will give you nothing in the long run.
Well, it worked for me. :agree:
The methods that can be used to assimilate knowledge are legion. :agree:
Dogmatism is the enemy. :agree:

Pegasus
12-16-2008, 08:08 PM
C&P without taking the time to try to understand what you're doing isn't of value, Coot. You stopped to look at the code and try to figure out what it was doing and how. *That's* learning. Just copying the code without thinking about how it's put together and why is just copying. It doesn't promote understanding. I think that's what Vege was getting at.

For example, I C&P javascript and it shows in some of the outdated and awkward code I've presented as "a solution". I know you've fixed my code up at least once.