Login   Register  
PHP Classes
elePHPant
Icontem

File: v03/scriptprogress.js

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  Script Progress  >  v03/scriptprogress.js  >  Download  
File: v03/scriptprogress.js
Role: Auxiliary script
Content type: text/plain
Description: javascript helper
Class: Script Progress
Flush page output to show progress of server task
Author: By
Last change: enhance
Date: 2012-03-17 08:02
Size: 858 bytes
 

Contents

Class file image Download

var $=function(id) {
  return document.getElementById(id);
}

var notify=function(s,r) {
  if(!$("center")) {
    var n = document.createElement("div");
    n.setAttribute("id", "center");
    n.setAttribute("class", "center");    
    document.body.appendChild(n);
  }
  if(!$("notify")) {
    var n = document.createElement("div");
    n.setAttribute("class", "notify");
    var n2 = document.createElement("dl");
    n2.setAttribute("id", "notify");
    n.appendChild(n2)
    
    $("center").appendChild(n);
  }

  var dt = document.createElement("dt");
  var ddt = document.createTextNode(s);
  dt.appendChild(ddt);  
  $("notify").appendChild(dt);

  if(r!=null){
    var dd = document.createElement("dd");
    var ddt2 = document.createTextNode(r);
    dd.appendChild(ddt2);
    $("notify").appendChild(dd);
  }  
}