Testing the last 6 characters in a string derived from document.images[].src. My "if" condition statement always passes the test, even when they should fail. The variable "test_result" always has a value of 3 at the end of the function. I have tried using "==" in the condition statement with the same result. Thanks for your help
function test_it()
{
var test_result = 0;
var test1 = document.images[0].src;
test1 = test1.substring(test1.length, test1.length - 6);
if (test1 = "52.gif")
{
test_result ++
}
var test2 = document.images[1].src;
test2 = test2.substring(test2.length, test2.length - 6);
if (test2 ="48.gif")
{
test_result ++
}
var test3 = document.images[2].src;
test3 = test3.substring(test3.length, test3.length - 6);
if (test3 = "47.gif")
{
test_result ++
}
if (test_result = 3)
{
document.getElementById("ta").value = test1 + " " + test2 + " " + test3 + " " + test_result
}
else
{
return
}
}