Ajax Talk - Asynchronous javascript and xml discussion board
 FAQ   Search    Usergroups      Register   Profile   Check your messages   Log in 
Signup now to enjoy a range of free membership advantages !!
Ajax Talk - Moderators Wanted
Running JS in an by Ajax included PHP code

Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help
View previous topic :: View next topic  
Author Message
New one
New one

Joined: 07 Feb 2008
Posts: 1

PostPosted: Thu Feb 07, 2008 12:16 pm    Post subject: Running JS in an by Ajax included PHP code Reply with quote

Hi all,

I pretty new with ajax and javascript and have a problem.
On my site, I have some tabs to switch between several types of content, like news, articles, media and all.

An ajax scripts includes the result of a php script. The php script gets some data from the database and shows the results (the last 30 rows). After 10 rows, I want to display a banner. The banner is displayed by a javascript code.

I tried something with the oncomplete function, but my ajax and javascript knowledge is too low to get the result I want.

The code where the tabs are shown and the ajax code places the result of the php file in the headlines_ajax div:

var objHeadlines;

function headlines(type) {
   var pagina = "ajax_headlines.php?tijd=" + Date() + "&type=" + type;

   objHeadlines = createRequestObject();

   objHeadlines.open("GET", pagina, true);
   objHeadlines.onreadystatechange = headlinesDiv;

   objHeadlines.setRequestHeader("Cache-Control", "no-cache");
   objHeadlines.setRequestHeader("X_USERAGENT", "AjaxApplicatie");

function headlinesDiv() {
   if (objHeadlines.readyState == 4 && objHeadlines.status == 200) {
      if (objHeadlines.responseText) {
         document.getElementById("headlines_ajax").innerHTML = objHeadlines.responseText;

<div class="boxTabsH">
   <div id="tabHeadlines" class="tabHAlles"></div>
   <div class="boxTabH6"></div>
   <div class="boxTabH1" onClick="document.getElementById('tabHeadlines').className = 'tabHAlles'; headlines('alles');" onMouseOver="this.style.cursor='pointer';" onMouseOut="this.style.cursor='default';"></div>
   <div class="boxTabH2" onClick="document.getElementById('tabHeadlines').className = 'tabHNieuws'; headlines('nieuws');" onMouseOver="this.style.cursor='pointer';" onMouseOut="this.style.cursor='default';"></div>
   <div class="boxTabH3" onClick="document.getElementById('tabHeadlines').className = 'tabHArtikelen'; headlines('artikelen');" onMouseOver="this.style.cursor='pointer';" onMouseOut="this.style.cursor='default';"></div>
   <div class="boxTabH4" onClick="document.getElementById('tabHeadlines').className = 'tabHVideos'; headlines('videos');" onMouseOver="this.style.cursor='pointer';" onMouseOut="this.style.cursor='default';"></div>
   <div class="boxTabH5" onClick="document.getElementById('tabHeadlines').className = 'tabHScreens'; headlines('screens');" onMouseOver="this.style.cursor='pointer';" onMouseOut="this.style.cursor='default';"></div>
<div id="headlines_ajax">

In the PHP file, the code counts the results and after 10 rows of the 30, the banner should be placed.

// some code for getting the data out of the database is removed

if ($bannerCount == 10) {
   $betweenItems = true;
   <div id="bannerCenter" class="bannerCenter">
      <script language="JavaScript" type="text/javascript">
         if (typeof(et_ord)=='undefined') et_ord=Math.floor(Math.random()*10000000000000000);
         if (typeof(et_tile)=='undefined') et_tile=1;
         document.write('<scr'+'ipt language="JavaScript" src="http://ad.uk.doubleclick.net/adj/dqa.domain.ext/rectangle;sz=336x280;tile=' + (et_tile++) + ';ord=' + et_ord + '?" type="text/javascript"></scr' + 'ipt>');
   <script language="JavaScript" type="text/javascript">
      function showBannerCenter() {
         if (document.getElementById('bannerCenter').clientHeight <= 14) {
            document.getElementById("skinBoxItemAdd").style.display = 'none';
            document.getElementById("bannerCenter").style.display = 'none';

// some code for displaying the results is removed

Hopefully someone can help me with this.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ajaxtalk.com Forum Index -> AJAX Help All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 XML & Copyright Notice 

Powered by phpBB © 2001, 2005 phpBB Group

What is according to Wikipedia: Ajax Web2.0 XML E4X

Link to our site:


del.icio.us digg spurl wists simpy newsvine blinklist furl blogmarks yahoo! myweb smarking ma.gnolia segnalo reddit fark technorati cosmos

Normal Bookmark

Partner Button Links:
Codecrunch.com: Webmaster Tutorials    One Ajax

Partner Text Links:
quomon | web20log | ajaxmatters | tableless | 456bereastreet | music charts | gift ideas | competitions | free xbox 360 | link trade ?

it consultancy & project management lead generation zoekmachine optimalisatie steal these buttons seo expert