The src property usually contains an expanded URL, not a relative one. So you're comparing (for instance), http://example.com/img/captcha/captcha_0.jpg with img/captcha/captcha_0.jpg and so it doesn't match.
You can check if it just ends with that:
if (document.getElementById("captch_style").src.substr(-source_one.length) === source_one) {
// It does
}
else {
// It doesn't
}
The substr function returns a substring of the string you call it on. If you call it with a negative index, it starts from the end of the string and counts back, so "abcdef".substr(-2)gives you"ef"`.
Alternately, you could just get the src attribute rather than the property (.getAttribute("src")), which should contain whatever you have literally in the HTML for the image, but some browsers (just old ones?) may expand that improperly. (I don't recall if it happens with the src attribute, it certainly used to with href on a elements.)
Separately, as Shomz points out in a comment, you must not have a script tag in your JavaScript file; I'd expect that to give you a syntax error, though perhaps some browser JavaScript engines may tolerate it. A JavaScript file just contains JavaScript code. script tags are for putting blocks of JavaScript code within an HTML file.
scripttag in your js file.