javascript在线格式化与压缩工具

javascript在线格式化与压缩工具

提示:您可以先修改部分代码再运行
<script> function runCode(cod1){cod=document.getElementById(cod1);var code=cod.value;if(code!=""){var newwin=window.open('','','');newwin.opener=null;newwin.document.write(code);newwin.document.close();}} function copycode(obj){var temp=document.getElementById(obj);if(document.all){var rng=document.body.createTextRange();rng.moveToElementText(temp);rng.scrollIntoView();rng.select();rng.execCommand("Copy");rng.collapse(false);}else {window.alert("此功能仅在IE上有效");}} function saveCode(obj){var winname=window.open('','_blank','top=10000');winname.document.open('text/html','replace');winname.document.write(obj.value);winname.document.execCommand('saveas','','code.htm');winname.close();} function doCopy(obj){var rng=document.body.createTextRange();rng.moveToElementText(obj);rng.scrollIntoView();rng.select();rng.execCommand("Copy");rng.collapse(false);} function vote(obj1,obj2){var option1=document.getElementById("option1");var option2=document.getElementById("option2");var toupiao4=document.getElementById("toupiao4");var url="/article/vote.asp?id="+obj1+"&option="+obj2+"&"+Math.random();var xmlhttp;try{xmlhttp=new ActiveXObject('Msxm12.XMLHTTP');}catch(e){try{xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');}catch(e){try{xmlhttp=new XMLHttpRequest();}catch(e){}}} xmlhttp.open("get",url,true);xmlhttp.onreadystatechange=function(){if(xmlhttp.readyState<4){toupiao4.style.display="block";} if(xmlhttp.readyState==4){toupiao4.style.display="none";newwidth=xmlhttp.responseText;if(obj2==1){option1.style.width=xmlhttp.responseText+"px";option2.style.width=100-xmlhttp.responseText+"px";} else{option2.style.width=xmlhttp.responseText+"px";option1.style.width=100-xmlhttp.responseText+"px";}}} xmlhttp.send(null);} function check() {var book=document.forms["book"];if(book.elements["nname"].value=="") {alert("名字不为空");return false;} if(book.elements["nword"].value=="") {alert("内容不为空");return false;}} function $(id){return document.getElementById(id);} function copyIdText(id) {copy($(id).innerText,$(id));} function copy(txt,obj) {if(window.clipboardData) {window.clipboardData.clearData();window.clipboardData.setData("Text",txt);alert("复制成功!") if(obj.style.display!='none'){var rng=document.body.createTextRange();rng.moveToElementText(obj);rng.scrollIntoView();rng.select();rng.collapse(false);}} else{alert("请选中文本,使用 Ctrl+C 复制!");}} function $code(){for(var i=0;i
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值