I have a function where I want to read the length of the path of a image source and use it in an if else clause but the variable which it is supposed to contain the numeric value seems empty. Neither the if clause nor the else one is being used.
<!DOCTYPE html>
<html>
<head>
<script>
function imgresize(img){
var strl=img.src.length;
if(strl<10)
{
//do someting
}
else
//do something
}
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
<img onclick="imgresize(this)" src="image1.png">
</body>
</html>
Any idea why this strl variable is not being filled?