  
  //加入收藏
function AddFav()
{
	window.external.addFavorite(window.document.location.href,document.title);
}

//内容字体大小调整
function ChangeSize(size){
	var objSize=getByID('Content');
	objSize.style.fontSize=size+"px";
}

//获得字体表格ID号并进行给值
function getByID(StringID)
{
	try
	{
		return document.getElementById(StringID);
	}
	catch (e){}	
}

//防框架
if (top.location != self.location)
    top.location=self.location;
	
	
function getByid(id) {
	if (document.getElementById) {
		return document.getElementById(id);
	} else if (document.all) {
		return document.all[id];
	} else if (document.layers) {
		return document.layers[id];
	} else {
		return null;
	}
}


function creatID(DivID){
var objs=getByid(DivID).getElementsByTagName('textarea');
var inps=getByid(DivID).getElementsByTagName('input');
var buts=getByid(DivID).getElementsByTagName('button');
var labs=getByid(DivID).getElementsByTagName('label');
	for (i=0; i<objs.length; i++) {
		objs[i].id="runcode"+i;
		inps[i].id=i
		buts[i].id=i
		labs[i].id=i
	}
}
function runCode(obj){  //定义一个运行代码的函数，
	  var code=getByid("runcode"+obj).value;//即要运行的代码。
	  var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
	  newwin.opener = null // 防止代码对论谈页面修改
	  newwin.document.write(code);  //向这个打开的窗口中写入代码code，这样就实现了运行代码功能。
	  newwin.document.close();
}

function doCopy(obj) { 
	if (document.all){
		 textRange = getByid("runcode"+obj).createTextRange(); 
		 textRange.execCommand("Copy"); 
		 alert("代码已经复制到剪切板");
	}else{
		 alert("此功能只能在IE上有效\n\n请在文本域中用Ctrl+A选择再复制")
	}
}

function saveCode(obj) {
        var winname = window.open('','','width=0,height=0,top=200,left=200px');
        winname.document.open('text/html', 'replace');
        winname.document.write(obj.value);
        winname.document.execCommand('saveas','','演示.html');
        winname.close();
}


//剪切代码
function cut(obj) { 
	if (document.all){
		 textRange = getByid("runcode"+obj).createTextRange(); 
		 textRange.execCommand("cut"); 
		 alert("代码已经剪切到剪切板");
	}else{
		 alert("此功能只能在IE上有效\n\n请在文本域中用Ctrl+A选择再剪切")
	}
}

//粘贴代码
function paste(obj) { 
	if (document.all){
		 textRange = getByid("runcode"+obj).createTextRange(); 
		 textRange.execCommand("paste"); 
		 alert("粘贴代码");
	}else{
		 alert("此功能只能在IE上有效\n\n请在文本域中用Ctrl+v选择再粘贴")
	}
}

function runCode(obj){  //定义一个运行代码的函数，
	  var code=getByid("runcode"+obj).value;//即要运行的代码。
	  var newwin=window.open('','','');  //打开一个窗口并赋给变量newwin。
	  newwin.opener = null // 防止代码对论谈页面修改
	  newwin.document.write(code);  //向这个打开的窗口中写入代码code，这样就实现了运行代码功能。
	  newwin.document.close();
}

function jsobj6(obj){getByid("runcode"+obj).value='';}
function jsobj7(obj){window.location.href='http://www.qwbm.com';}
function jsobj8(obj){javascript:self.close();} 
