dhtmlxCalendar + AJAX

I’m know you’re not a charity company



But i’m stack, a ask help another forum but nobody know the right answer.



I ask this question before. I would like use dhtmlx calendar and dhtmlx window on ajaed page, but not working



I use two methods .



1. I but common scripts into the main html



first.html











xmlhttp.js //code fragment

xmlhttpRequest … document.getElementById(obj).innerHTML = ajaxRequest.responseText;



ajaxed page this page loading into teh div

2.html



You can attach calendar to input object.1

















Click in a text fild


            

    





this not working



and secound method



first.html

nothing scripts just xmlhttp.js



xmlhttp.js// fragment

eval()

function run(objekt) div name

{

var scripttags = objektum.getElementsByTagName(‘script’);

for(var no=0;no < scriptag.length; no++) {

eval(scriptag[no].innerHTML);

}

}



2.html



all the scripts that need to run dhtmlx calendar like the demos



not working.



I very very grateful if you can send me the demo or take an advice



thanks again

The simple injecting html data in page will not execute code in script section ( at least not in FF )
You need to use any lib which can handle inline js in loaded code, or use your own custom code to resolve problem, something similar to next.

document.getElementById(obj).innerHTML = ajaxRequest.responseText;

            var z = ajaxRequest.responseText.match(/<script[^>]>[^\f]?</script>/g);
                if (z)
                      for (var i=0; i<z.length; i++){
                           if (window.execScript)
                               window.execScript(z[i].replace(/<([/]{0,1})script[^>]>/g,""));
                           else
                               window.eval(z[i].replace(/<([/]{0,1})script[^>]>/g,""));
                      }
           

   

thanks but i don’t know where to insert var z=ajax.responseText code

It must be placed instead of existing script processing code. I don’t sure where it in your case.
Most probably changing

var scripttags = objektum.getElementsByTagName(‘script’);
for(var no=0;no < scriptag.length; no++) {
eval(scriptag[no].innerHTML);

to the

var scripttags = objektum.getElementsByTagName(‘script’);
for(var no=0;no < scriptag.length; no++) {
if (window.execScript)
window.execScript(scriptag[no].innerHTML);
else
eval(scriptag[no].innerHTML);

must resolve issue