1) Script Title: Dynamic Ajax Content
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxcontent.htm
3) Describe problem: Is it possible to alter the script so it points to a div class instead of an id?
thanks
1) Script Title: Dynamic Ajax Content
2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxcontent.htm
3) Describe problem: Is it possible to alter the script so it points to a div class instead of an id?
thanks
I'm not sure why you would want to do this. Are you trying to fill multiple divisions on the same page with the same content simultaneously? Or, is it that you just prefer class to id? Either way, you could change this:
to:Code: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 }
Now class will work like id used to for this script (id will no longer work). I wrote the above for divisions only but, it could be written for other elements or, for all elements that support the class attribute.Code:function loadpage(page_request, containerid){ if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1)){ var theDivs=document.getElementsByTagName('div'); for (var i_tem = 0; i_tem < theDivs.length; i_tem++) if (theDivs[i_tem].className==containerid) theDivs[i_tem].innerHTML=page_request.responseText } }
- John________________________
Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate
Thanks a lot John!
I do want to fill multiple divisions, as I want to use it to show entries of my CMS(Expression Engine).
Otherwise it would fill the page with div id's, and that is not what id's stand for, do they.
I had already found a workaround by setting the entry limit to "1", but this is even better!
thanks again...
Bookmarks