PDA

View Full Version : Dynamic AjAX contend - IE problems



zadlo_PL
05-07-2006, 09:56 AM
Dynamic Ajax Content
http://www.dynamicdrive.com/dynamicindex17/ajaxcontent.htm

Hi, the script i awsome !!, but I have a little problem with IE, because my content have a png images so a have a png fix script, but in IE when I cratinga link to load:


<a href="javascript:ajaxpage('budowa.html', 'okno_wlasciwe'); loadobjs('css/glowne_style.css', 'js/bgsleight');">Aktualnosci</a>

The same script is loading in index page and there is working but in AjAX div not :(, I tried to change the name of loading to div script but nothing hapends. Can someone help me??? :( pls.

Ps. Sorry for my bad english :p

jscheuer1
05-08-2006, 03:49 AM
This has come up before. If you have a script loaded on the page and you then load more content via the AJAX include that you want to be acted upon by your script, you have to figure out what is really going on and what you want to have happen. Just loading the whole script all over again will likely create conflicts with its first run that occurred when the page was first loaded. More likely, all you need to do is load a small script that runs the functions of the main script that are relevant to the newly included content.

zadlo_PL
05-08-2006, 12:03 PM
Will you help me with that script ?? because i'm a noob in java and php.....????? Can You???

jscheuer1
05-08-2006, 05:26 PM
I'm a little weak in AJAX and PHP but have a rough understanding of what is going on there. I'm fairly strong in javascript. There is no Java involved here (that's a different language).

If you provide a link to your page, I will try to find the relevant code and a way to modify it. Unfortunately, my favorite tool - setting up a local demo, is probably impossible or highly complex owing to the domain specific nature of portions of AJAX. I have other tools though, so I'll give it my best shot if you provide the link:

Please post a link to the page on your site that contains the problematic script so we can check it out.

zadlo_PL
05-08-2006, 09:40 PM
OK
http://www.karolewo.com/test/index.html you need to hit the Aktualnosci button, and here's a link to that script http://www.karolewo.com/test/js/bgsleight.js

jscheuer1
05-09-2006, 06:52 AM
OK, you threw me a little there at first. The link you gave me was to a frameset, the actual page is:

http://edu.apple.pl/zsliz_karolewo/test/index.html

The problem is just as I suspected, js/bgsleight.js is already loaded on that page, it doesn't need to be loaded again, and loading it again will do nothing, at least nothing good. And we need to be sure that the css is loaded first. So, to start, change your link for the Aktualnosci button to:


<a href="javascript:loadobjs('css/glowne_style.css'); ajaxpage('budowa.html', 'okno_wlasciwe');">Aktualnosci</a>

Now all we need to do is look in the script for Dynamic Ajax Content (/js/DAC.js) to see where we need to run the function alphaBackgrounds() from
the js/bgsleight.js script. I vote for here:


function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
document.getElementById(containerid).innerHTML=page_request.responseText
}

Find the above in /js/DAC.js and change it to:


function loadpage(page_request, containerid){
if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){
document.getElementById(containerid).innerHTML=page_request.responseText
if (navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent)
alphaBackgrounds();
}
}

That should do it. Except if there is a problem in running alphaBackgrounds() in IE every time you call the ajaxpage() function. If so, more work needs to be done.

There is one other matter, on:

http://edu.apple.pl/zsliz_karolewo/test/index.html

where you have:


<script language="javascript" src="js/DAC.js"></script>

To follow the terms of use at DD, it should read:


<script language="javascript" src="js/DAC.js">

/***********************************************
* Dynamic Ajax Content- Dynamic Drive DHTML code library (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
***********************************************/

</script>

zadlo_PL
05-09-2006, 07:32 AM
Your great THX, A BIG THX :).........And sorry for that terms, I thought that if they are placed in DAC.js everthing is ok. Many thx :)