Hi,
I load some javascript functions through a string in to a div of a html file
also i set an onclick event to a td thru setAttribute.
This works fine if there is just an alert or a scripts without functions (in this case the string is passed asit is).
the string is with function and statement inside it is written inside a div with creating script tags at he begging and end . Now When i assing the function to the td thru setAttribute the function inside the div is not called.
I tried it to insert into the Head tag also even then its not working.
the error is : the function is not defined.
Any Suggestions PLS
.... Looking Forward.
The Code
***********
function external(){
var headID = document.getElementsByTagName("head")[0];
var newScript = document.createElement('script');
newScript.type = 'text/javascript';
newScript.onload = testfn;
headID.appendChild(newScript);
}
if (xmlhttp.readyState == 4){
var response = xmlhttp.responseText;
var thisdoc = xmlhttp.responseXML;
var domParser = new DOMParser();
var xmlroot = domParser.parseFromString(response,'application/xml');
if(xmlroot.selectSingleNode("//ProductsData/test")){
testfn = xmlroot.selectSingleNode("//ProductsData/test/text()").nodeValue;
external();
document.getElementById("content1").setAttribute(" onClick",xmlTest());
}
}
Thanks in advance..
Looking Forward for a reply