My question is more Javascript DOM than Coldfusion question but I am posting on
this site as one of the most accurate forums in the field.
The following function is the result function of an AjaxCFC query. It takes the
structure of arrays builded from the query and by looping on 2 arrays
(name, name_displayed) it builds a list with active links.
For the creation of the list it has been used the DOM technology:
function doMenuQueryResults (r) {
var navBar = document.getElementById('navBar');
for(i=0;i<r.name.length;i++){
//Create a DIV element and give it id sectionLinks1
var divSectionLinks1 = document.createElement('div');
divSectionLinks1id = document.createAttribute('id');
divSectionLinks1id.value = 'sectionLinks1';
divSectionLinks1.setAttributeNode(divSectionLinks1id);
//Define divSectionLinks1as append child of navBar
navBar.appendChild(divSectionLinks1);
//Create a UL element and define it as append child of divSectionLinks1
var ul1=document.createElement('ul');
divSectionLinks1.appendChild(ul1);
//Create a LI element and define it as append child of ul1
var myList1 = document.createElement('li');
ul1.appendChild(myList1);
//Create an A element and set attributes (href, class, name, onClick)
var a1 = document.createElement('a');
a1href = document.createAttribute('href');
a1href.value = '#';
a1.setAttributeNode(a1href);
a1class = document.createAttribute('class');
a1class.value = 'links';
a1.setAttributeNode(a1class);
a1name = document.createAttribute('name');
a1name.value = r.name[i];
a1.setAttributeNode(a1name);
a1onClick = document.createAttribute('onClick');
a1onClick.value = 'FunCall(this.name);'
a1.setAttributeNode(a1onClick);
myList1.appendChild(a1);
//Create text node for a1
var text1=document.createTextNode(r.name_displayed[i]);
a1.appendChild(text1);
}
}
While everything runs ok in Firefox (the function takes the result from he
ajaxcfc query and creates the list with the on click links), in IE the list is
getting created but the onclick links are like dead.
Any ideas are more than welcome.
Regards
Ioannis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Upgrade to Adobe ColdFusion MX7
Experience Flex 2 & MX7 integration & create powerful cross-platform RIAs
http:http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU
Archive:
http://www.houseoffusion.com/groups/Javascript/message.cfm/messageid:3561
Subscription: http://www.houseoffusion.com/groups/Javascript/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.33