//zszen output js
var isOutputDisplay=true
var __output_arr=[];
var __presetFunct=null;
var __presetParams=null;
function output(info){
if(!isOutputDisplay)return;
var target = document.getElementById("output_txt");
if(target==null && document && document.body){
var output_div=document.createElement("div")
output_div.setAttribute("id","output_div");
output_div.setAttribute("name","output_div");
output_div.style.position = "absolute";
output_div.style.opacity = ".75";
output_div.style.left = "0px";
output_div.style.top = "0px";
document.body.appendChild(output_div);
var output_txt=document.createElement("textarea")
output_txt.setAttribute("id","output_txt");
output_txt.setAttribute("name","output_txt");
output_txt.setAttribute("rows","17");
output_txt.setAttribute("cols","20");
output_txt.style.border = "0px";
output_txt.style.resize = "none";
// output_txt.style.backgroundColor = "#EEEEEE";
output_div.appendChild(output_txt)
target = output_txt;
target.value = "output inited !"
}
if (target) {
if (__presetFunct!=null ) {
if(__presetParams!=null)__presetFunct.apply(null,__presetParams[0])
else __presetFunct();
__presetFunct=null
__presetParams=null
}
if(__output_arr && __output_arr.length>0){
__output_arr.reverse();
target.value = __output_arr.join("\n")+"\n"+target.value;
__output_arr=null
}
target.value = Array.prototype.join.call(arguments,", ")+"\n"+target.value;
}else{
__output_arr.push(Array.prototype.join.call(arguments,", "))
}
}
function output_setSize(cols,rows){
var output_txt=document.getElementById("output_txt")
if(output_txt==null){
__presetFunct=arguments.callee;
__presetParams =Array.prototype.concat.call(arguments)
}else{
if(rows>0)output_txt.setAttribute("rows",rows);
if(cols>0)output_txt.setAttribute("cols",cols);
}
}
//
function __output_init(func) {
var oldonload = window.onload;
if (typeof window.onload != 'function') {
window.onload = function() {
func("window loaded !");
}
} else {
window.onload = function() {
oldonload();
func("window loaded !");
}
}
}
__output_init(output)
转载于:https://my.oschina.net/u/1866599/blog/287678