Categories | Question details Back To List | ||
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 <script> window.dhx_globalImgPath="calendar/imgs/"; </script> <script src="calendar/dhtmlxcommon.js"></script> <script src="calendar/dhtmlxcalendar.js"></script> <script src="xmlhttp.js"></script> xmlhttp.js //code fragment xmlhttpRequest .... document.getElementById(obj).innerHTML = ajaxRequest.responseText; ajaxed page this page loading into teh div 2.html <script language="javascript" type="text/javascript"> var cal1; var dateFrom = null; var dateTo = null; cal1 = new dhtmlxCalendarObject('calInput1'); </script> <p> You can attach calendar to input object.1</p> <table > <tr> <td valign="top"><strong>Click in a text fild</strong><br /> <input type="text" id="calInput1" style="width: 200px; font-size:12px;" readonly="true"> </td> </tr> </table> 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 Answer posted by Support on Jul 28, 2008 03:48 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,"")); } Answer posted by aspi on Aug 03, 2008 10:50 thanks but i don't know where to insert var z=ajax.responseText code Answer posted by Support on Aug 04, 2008 06:05 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 |