资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
javascript实现的样式表(CSS) 格式整理与压缩
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>样式表(CSS) 格式整理与压缩</title> <style type="text/css"> html,body,form,fieldset,textarea { height:100%; margin:0; padding:0; border:0; font-size:10pt; background:#eee; } form { margin:0 1%; overflow:hidden; } legend { line-height:3em; font-weight:bolder; } button { float:left; margin:1% 1% 0 0; cursor:pointer; } textarea { width:100%; height:20em; border:1px solid #ccc; display:block; background:#fff; } </style> </head> <body> <form action="" onsubmit="return false"><fieldset> <legend>样式表(CSS) 格式整理与压缩</legend> <textarea name="" rows="" cols="" id="codeText"> body * { font-size:10pt; }/* ss sda */ p { clear:left; padding:5px 10px; } td , fieldset { padding : 10px ; } textarea { width:90%; height:10em; } </textarea> <button type="button" onclick="$('codeText').value=code.A();">压缩代码</button> <button type="button" onclick="$('codeText').value=code.B();">格式(多行)</button> <button type="button" onclick="$('codeText').value=code.C();">格式(单行)</button> <button type="button" onclick="$('codeText').value=code.Z();">还原代码</button> </fieldset></form> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%20type%3D%22text%2Fjavascript%22%3E%20%0D%0Afunction%20%24(id)%7Breturn%20document.getElementById(id)%3B%7D%20%0D%0Afunction%20codeZip(obj)%7B%20%0D%0Athis.S%3Dfunction()%7B%20%0D%0Avar%20code%3Dobj.value%3B%20%0D%0Aif(!this.codeZ%7C%7Cthis.codeZ%3D%3D%22%22)this.codeZ%3Dcode%3B%20%0D%0Acode%3Dcode.replace(%2F(%5Cn%7C%5Ct%7C%5Cs)*%2Fig%2C'%241')%3B%20%0D%0Acode%3Dcode.replace(%2F%5Cn%7C%5Ct%7C%5Cs(%5C%7B%7C%5C%7D%7C%5C%2C%7C%5C%3A%7C%5C%3B)%2Fig%2C'%241')%3B%20%0D%0Acode%3Dcode.replace(%2F(%5C%7B%7C%5C%7D%7C%5C%2C%7C%5C%3A%7C%5C%3B)%5Cs%2Fig%2C'%241')%3B%20%0D%0Areturn%20code%3B%20%0D%0A%7D%20%0D%0Athis.A%3Dfunction()%7B%20%0D%0Avar%20code%3Dthis.S()%3B%20%0D%0Areturn%20code%3B%20%0D%0A%7D%20%0D%0Athis.B%3Dfunction()%7B%20%0D%0Avar%20code%3Dthis.S()%3B%20%0D%0Acode%3Dcode.replace(%2F(%5C%7B)%2Fig%2C'%20%241')%3B%20%0D%0Acode%3Dcode.replace(%2F(%5C%7B%7C%5C%3B)%2Fig%2C'%241%5Cn%5Ct')%3B%20%0D%0Acode%3Dcode.replace(%2F%5Ct*(%5C%7D)%2Fig%2C'%241%5Cn')%3B%20%0D%0Acode%3Dcode.replace(%2F(%5C*%5C%2F)%2Fig%2C'%241%5Cn')%3B%20%0D%0Areturn%20code%3B%20%0D%0A%7D%20%0D%0Athis.C%3Dfunction()%7B%20%0D%0Avar%20code%3Dthis.S()%3B%20%0D%0Acode%3Dcode.replace(%2F(%5C%7D)%2Fig%2C'%241%5Cn')%3B%20%0D%0Acode%3Dcode.replace(%2F(%5C*%5C%2F)%2Fig%2C'%241%5Cn')%3B%20%0D%0Areturn%20code%3B%20%0D%0A%7D%20%0D%0Athis.Z%3Dfunction()%7B%20%0D%0Areturn%20(this.codeZ)%3Fthis.codeZ%3Aobj.value%3B%20%0D%0A%7D%20%0D%0Avar%20my%3Dthis%3B%20%0D%0Aobj.onkeydown%3Dfunction()%7B%20%0D%0Amy.codeZ%3D%22%22%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0Avar%20code%3Dnew%20codeZip(%24('codeText'))%3B%20%0D%0A%3C%2Fscript%3E"> </body> </html>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程