JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old October 13th, 2011, 05:07 PM
crakrman crakrman is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2011
Posts: 2 crakrman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 26 sec
Reputation Power: 0
Need Help Debugging Script/Error in Script - Ajax issues in IE8... sometimes

I'm trying to build a slideshow/carousel similar to the one in use here: http://mix1065fm.radio.com/ (The block with 4 headlines on the left and a picture associated with the active one on the right.)

The way mine is built, it selects a slide and displays it for 15 seconds before moving on to the next slide. If you click a headline, it brings up that slide, and leaves it up for 30 seconds, before returning to the rotation.

I've used Ajax and PHP to make it work. All my tests in Firefox and Safari are working fine, but IE8 is sometimes giving problems... And it's the "sometimes" that has me stumped! All the systems I own do it fine, but some other people in my office aren't getting the 15-second automatic jump to the next slide feature to work. I've checked their versions of IE, and in general it's identical to mine. IE is not putting out an error code, so I don't even know where to begin looking to try to fix it.

The code I'm using is below. I'm sure there's a cleaner way to make this work, but I'm relatively new to Ajax, so forgive my poor coding...

Code:
function ajaxSLIDE(slide) {
	var xmlhttp;
	if (window.XMLHttpRequest) {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlhttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
	  // code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  alert("Your browser does not support XMLHTTP!");
	}

	xmlhttp.onreadystatechange=function() {
		if(xmlhttp.readyState==4 || xmlhttp.readyState=="complete") {
			document.getElementById('ReloadSLIDES').innerHTML=  xmlhttp.responseText;
		} else {
			document.getElementById('ReloadSLIDES').innerHTML=  "<table cellpadding=0 cellspacing=0 bgcolor=black width=750 height=250><tr><td class=ReloadSLIDES><font color=white><center>Loading...</td></tr></table>";
		}
	}
	xmlhttp.open("GET","/ajax/slides.php?data=<?php print time(); ?>&slide="+slide,true);
	xmlhttp.send(null);
}

var t;
var delay;
function Ajax(delay) {
	clearTimeout(t);
	if (delay == undefined) {
		delay = 15000;
	}
	var xmlHttp;
	if (window.XMLHttpRequest) {
	  // code for IE7+, Firefox, Chrome, Opera, Safari
	  xmlHttp=new XMLHttpRequest();
	} else if (window.ActiveXObject) {
	  // code for IE6, IE5
	  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	} else {
	  alert("Your browser does not support XMLHTTP!");
	}

	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.getElementById('ReloadSLIDES').innerHTML=  xmlHttp.responseText;
			t = setTimeout('Ajax()', delay);
		}
	}
	xmlHttp.open("GET","/ajax/slides.php?data=<?php print time(); ?>&delay=" + delay,true);
	xmlHttp.send(null);
}

window.onload=function() {
	setTimeout('Ajax()',0);
}


And the code that triggers the change to a selected slide goes within a <TD> tag as:

Code:
onClick=\"Ajax(30000); ajaxSLIDE($myrow[id]);\"


Thanks for any help you can provide...

Reply With Quote
  #2  
Old October 14th, 2011, 10:19 AM
crakrman crakrman is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2011
Posts: 2 crakrman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 24 m 26 sec
Reputation Power: 0
Figured it out... my cache-buster wasn't working. I guess a PHP-based cache-buster doesn't do the job. Once I wrote the "random" variable in javascript instead of PHP, it appears to be working fine now.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingJavaScript Development > Need Help Debugging Script/Error in Script - Ajax issues in IE8... sometimes


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap