this is baffling; I'm following an example out of Patrick Carey's latest book, and I get a "permission denied" error when the code hits a particular line. In his example, you're trying to create a collection(array) of elements with a class name of "menu" by sifting through all of the elements using the wildcard
"*"; see the code below. When the program hits - if(allEle[i].className=="menu") -- it causes the error. The write statements just above this prove that it gets to that line and chokes; the allEle collection (array) is 41 items long; here is the relevant stretch of code:
var menus=new Array();
for(var i=0;i<allEle.length; i++)
document.write("allele length value is:" + allEle.length + " <br />");
document.write("here is one loop" + "<br />");
}//end for loop
I would greatly appreciate any suggestions.
Two things are going on-
you are opening a new document with document.write,
and you are increasing the length of the node list with each pass through the loop, so it can never end.
thanks for taking the time to respond to me. I started using alerts instead of document.write and the error message went away.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)