I have this code below which I want to loop to check if variable hp length is zero or greater than zero else go back to check the value of hp.
For some reason, the call of setopt() in the else if section stops, its not calling the function. What could be the problem ?
Code:
<html>
<head>
<script>
var hp = "";
var ii = 0 ;
var j = 0;
function init()
{
ii = hp.length;
if (ii > 0)
{
document.body.innerText=hp;
}
else if (ii <= 0)
{
document.body.innerText=""
setopt();
}
}
function setopt()
{
ii=0;
hp = "";
hp ='some curl code';
init();
}
</script>
</head>
<body onpageshow="setopt()";>
</body>
</html>