Posted on: 4/2/2015 9:03:15 PM | Views : 563

I wrote a function to test javascript which works but only for a second!
The button starts out red (which is not detected at all) so I changed the else to blue just to see if it can change the color.  It does for a split second and then goes back to red.  Anyone know what would cause this?  Maybe it reloads the CSS style after it "reloads".  Also the reason I tested javascript is because i thought it would NOT reload like it does when I use a C# function (which changes the colors for good) but it refreshes anyways.
Anyone know what's going on in the background?
function changeColor(e) { if (e.style.backgroundColor == "red") { e.style.backgroundColor = "blue"; } else { e.style.backgroundColor = "blue"; } }

Go to the complete details ...