js output 输出浮层

//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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值