Как да сложа Ajax loader?

oveRLuckEd

Registered
Някой може ли да ми сложи един ajax loader, тоест картинка която зарежда преди да зареди извиканото съдържание, ето ви js-то
Код:
var Scriptaculous = {
  Version: '1.6.5',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
  },
  load: function() {
    if((typeof Prototype=='undefined') || 
       (typeof Element == 'undefined') || 
       (typeof Element.Methods=='undefined') ||
       parseFloat(Prototype.Version.split(".")[0] + "." +
                  Prototype.Version.split(".")[1]) < 1.5)
       throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
    
    $A(document.getElementsByTagName("script")).findAll( function(s) {
      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
    }).each( function(s) {
      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
      var includes = s.src.match(/\?.*load=([a-z,]*)/);
      (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
       function(include) { Scriptaculous.require(path+include+'.js') });
    });
  }
}

Scriptaculous.load();

не съм сигурен дали точно това трябва да дам за това ето ви и това което го има в индекса:
Код:
<script type="text/javascript">
function startLoading() {

Element.show('mainAreaLoading');
Element.hide('mainAreaInternal');
}
function finishLoading() {
Element.show('mainAreaInternal');
setTimeout("Effect.toggle('mainAreaLoading');", 0);
}

function loadContent(id) {
startLoading();
new Ajax.Updater('mainAreaInternal', 'rpc.php', {method: 'post', postBody:'content='+ id +''});
finishLoading();
}
</script>
 
Това ?

Код:
		<script type="text/javascript">
document.write('<font style="font-family:verdana;font-size:10px;">Моля почакайте!<br />( страницата се зарежда )</font>');
window.onload=function(){ document.getElementById("pageloading").style.display="none"; }
	 var Scriptaculous = {
  Version: '1.6.5',
  require: function(libraryName) {
    // inserting via DOM fails in Safari 2.0, so brute force approach
    document.write('<script type="text/javascript" src="'+libraryName+'"></script>');
  },
  load: function() {
    if((typeof Prototype=='undefined') ||
       (typeof Element == 'undefined') ||
       (typeof Element.Methods=='undefined') ||
       parseFloat(Prototype.Version.split(".")[0] + "." +
                  Prototype.Version.split(".")[1]) < 1.5)
       throw("script.aculo.us requires the Prototype JavaScript framework >= 1.5.0");
   
    $A(document.getElementsByTagName("script")).findAll( function(s) {
      return (s.src && s.src.match(/scriptaculous\.js(\?.*)?$/))
    }).each( function(s) {
      var path = s.src.replace(/scriptaculous\.js(\?.*)?$/,'');
      var includes = s.src.match(/\?.*load=([a-z,]*)/);
      (includes ? includes[1] : 'builder,effects,dragdrop,controls,slider').split(',').each(
       function(include) { Scriptaculous.require(path+include+'.js') });
    });
  }
}

Scriptaculous.load();
</script>
 
http://ajaxload.info/ - от тук можеш да вземеш картинка...
function ajaxLoader(url,id) {
if (document.getElementById) {
var x = (window.ActiveXObject) ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
}
if (x) {
x.onreadystatechange = function() {
if (x.readyState == 4 && x.status == 200) {
el = document.getElementById(id);
el.innerHTML = x.responseText;
}
}
x.open("GET", url, true);
x.send(null);
}
}
 
не ми трябва нов ajaxloader, еми просто някой да добави 1-2 реда в тоя код който съм дал, така че преди да заредите данните да зарежда има картинка там нещо или някакъв надпис да излиза "please wait..." или нещо от сорта
 
Мерси, но искам да ползвам този скрипт, никой ли няма да може да ми добави 1 картинка, моля ви..
 

Back
Горе