changing visibility using javascript

后端 未结 3 1217
时光取名叫无心
时光取名叫无心 2020-12-09 16:43

hi i have web page which uses ajax to retrieving data from another pages and while doing that i want to show a loading gif in the page so i\'ve create a div with my gif on i

3条回答
  •  没有蜡笔的小新
    2020-12-09 17:34

    If you just want to display it when you get a response add this to your loadpage()

    function loadpage(page_request, containerid){
       if (page_request.readyState == 4 && page_request.status==200) { 
          var container = document.getElementById(containerid);
          container.innerHTML=page_request.responseText;
          container.style.visibility = 'visible';
          // or 
          container.style.display = 'block';
    }
    

    but this depend entirely on how you hid the div in the first place

提交回复
热议问题