Results 1 to 1 of 1

Thread: Looping code

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 2021
    Posts
    38

    Looping code

    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>
    Last edited by UserBee; Nov 3rd, 2021 at 06:42 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width