Hello all, I’m rather a new to javascript (more of a backend guy usually). I’m trying to dynamically add some dom elements and I’m using a combination of prototype.js and Behaviour.js. Here’s the code I have regarding adding the dom elements:
[code]
function initialize(){
removeChildNodes($(‘customSearchPopup’));
for(var i=0; i<array.length; i++){
var splitLabel = array[i].split(“.”);
var actualLabel = splitLabel[splitLabel.length -1];
var a = document.createElement(“a”);
a.setAttribute(“href”,”#”);
a.innerHTML = actualLabel;
a.customSearch = data[array[i]];
$(‘customSearchPopup’).appendChild(a);
Event.observe(a, ‘click’, function(event){
var ahref = Event.element(event);
var terms = $A($(‘advancedSearchForm’).searchForm.getTerms());
terms.each(function(term){
term.searchTerm.removeThisTerm();
});
$(‘advancedSearchForm’).searchForm.deserialize(ahref.customsearch);
});
}
}
}
Behaviour.addLoadEvent(function(){
initialize();
});
the above code works just in both ie6 and ff2 but gives me nothing at all in ns7.02 (although in ie 6, a refresh of the page causes the same thing that happens in ns when the page is initially hit). I don’t believe this is an issue of compatibility between prototype/behavior and ns7 (at least I can’t find a reference to that anywhere) so I imagine it’s an issue of my incomplete grasp of javascript. Does anyone have any advice?