Valued colleagues,
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:
<script type=”text/javascript” >
var activemenu=null;
window.onload=init;
function init()
{
var menus=new Array();
var allEle=document.getElementsByTagName(“*”);
for(var i=0;i<allEle.length; i++)
{
document.write(“allele length value is:” + allEle.length + ” <br />”);
document.write(“here is one loop” + “<br />”);
if(allEle[i].className==”menu”)
{
menus.push(allEle[i]);
}
}//end for loop
I would greatly appreciate any suggestions.
captsig