हाय मुझे लगता है टाइमर शुरू करने से पहले आप लोड पूरी तरह से पेज चाहेगा अगली यूआरएल लोड करने के लिए, अन्यथा आप पूर्व से पहले अगला यूआरएल दिखाएंगे पेज को बर्बाद करना भी दिखाता है (आपकी इंटरनेट गति के आधार पर)। दूसरी बात आपने कहा कि आप यूआरएलएस घुमाने के लिए चाहते हैं।
<html>
<head>
<title></title>
<style type="text/css">
</style>
<script type="text/javascript">
var urls = [
"http://www.google.com"
,"http://www.yahoo.com"
,"http://www.ajaxian.com"
,"http://www.ebay.com"
];
function showUrl(idx) {
alert(idx + " Showing " + urls[idx]);
var f = document.getElementById("f");
// call the next load after 5 seconds only after
// this iframe loads
f.onload = function() {
var next = ++idx % urls.length;
setTimeout(function(){
showUrl(next);
}, 5000);
}
// set the src
f.src = urls[idx];
}
</script>
</head>
<body onload="showUrl(0)" class="app-chrome">
<iframe id="f" src="about:blank"></iframe>
</body>
</html>
एक अधिक कॉम्पैक्ट संस्करण जोड़ना::
<script type="text/javascript">
window.onload = (function(urls, interval) {
var idx = 0;
var bAttached = false;
return function showUrl() {
var f = document.getElementById("f");
var onLoad = function() { // loading only after previous page loads
idx = ++idx % urls.length; // rotation
setTimeout(showUrl, interval);
}
if(! bAttached) {
if(navigator.userAgent.indexOf("MSIE") !== -1) {
f.attachEvent("onload", onLoad);
bAttached = true;
}else {
f.onload = onLoad;
}
bAttached = true;
}
f.src = urls[idx];
};
})([
"http://www.google.com" ,"http://www.yahoo.com" ,
"http://www.sun.com" ,"http://www.ebay.com"
], 5000
);
</script>
मेरा उत्तर (2 संस्करण) देखें, यह आईई 6 – naikus
में काम करता है, मैं सुझाव देता हूं कि
@ ओझाकी आप एक उदाहरण pls प्रदान कर सकते हैं। धन्यवाद। – tonyf