Post your full script (or if it's too big, upload it somewhere) if you want more help with this. Anyway:
Be careful how you're using your braces ({}). Please see: http://www.youtube.com/watch?v=hQVTIJBZook (specifically around 12:20 (semicolon insertion and then later on), but watch the whole thing anyway).
The use strict issue is because you're doing that stuff outside of the function, rather than in its context:
"use strict";
function whatever() { }
rather than
function whatever() {
"use strict";
}
The quotes don't matter (as in, you can use single or double quotes) in the document.getElementById stuff. The warnings you're getting about your setTimeouts are easy to identify - pass the function, not a string. So instead of:
setTimeout("fading()",20);
or:
setTimeout('fading()',20);
use:
setTimeout(fading, 20);
Your equality warnings in whatever other code you haven't pasted (Line 99: if(event.keyCode=='65') {fadefemale(); fadefemale(); } Expected '===' and instead saw '=='.) etc are due to you not using "===" as you figured.
When you do that in the code you've pasted, you're comparing a string (you are wrapping the number in quotes) to the keyCode (which is a number), so of course it will fail (the == doesn't care about that, but avoid using it for reasons demonstrated in the video above).
Change:
event.keyCode=='65' // <-- single quotes around the 65 make it a string
to:
event.keyCode === 65 // num is exactly equal to num in both value AND type
(see 14:40 of that video (and later for further examples) for an explanation of that).
Here's how your original code might look (whether or not it will work is another matter, but it should pass validation):
var fd = 255;
function fading() {
"use strict";
if (fd > 0) {
fd -= 200;
document.getElementById("female").style.color = "rgb("+fd+","+fd+","+fd+")";
setTimeout(fading, 20);
} else {
fd = 255;
}
}
That's really not the best way of going about "use strict", though. See:
http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more /
And look for the part about anonymous functions.