I am trying to display results using confirm pop up box. My problem is that I cannot seem to get my while statement to fire when using the confirm result placed in a varible:
function load(){
var j = 0;
var l = document.links.length;
userInput = true;
while((userInput == true) && (j < l))
{
userInput = confirm("This prompt will continue to list all " + l + " links in current document.\n" +"Link: " + j + " is " + window.document.links[j].href) + "\n";
j = j + 1 ;
}
}
I've tried many variations of if, do-while, while, ffs! This current chunk just displays the 0 href and then drops out of the loop. When I remove (userInput == true) then the loop continues for the remainder of the (j < l) condition.
I want user to be able to cancel the pop up AND to understand why my condition does not work as expected. Thanks all!