js文件的空格占字节的.
写成一行能缩小文件大小.文件越大效果越好.
你用Eclipse,可以下载一个插件Aptana,安装完后
工具栏多了一个选项:
js在线压缩
js在线解压工具
写成一行能缩小文件大小.文件越大效果越好.
你用Eclipse,可以下载一个插件Aptana,安装完后
工具栏多了一个选项:
Scripts ---> Javascript ----> Compact
xtarea + js 就能很简单滴实现
L@_@K
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
>
<
title
> new document </
title
>
<
meta
name
=
"generator"
content
=
"editplus"
/>
<
meta
name
=
"author"
content
=
""
/>
<
meta
name
=
"keywords"
content
=
""
/>
<
meta
name
=
"description"
content
=
""
/>
</
head
>
<
body
>
<
textarea
id
=
"ttaInput"
rows
=
"10"
cols
=
"100"
>function helloWorld(sYourName)
{
alert("Hello, " + sYourName);
}
helloWorld("csdn");</
textarea
>
<
input
type
=
"button"
id
=
"btnJoin"
value
=
"Join Lines"
/>
</
body
>
<
script
type
=
"text/javascript"
>
<!--
function $(sId)
{
return document.getElementById(sId);
}
String.prototype.trim = function() {
return this.replace(/(^\s*)|(\s*$)/g, "");
};
$("btnJoin").onclick = function() {
var oArea = $("ttaInput");
var strArray = oArea.value.split("\r\n");
if (strArray.length > 1)
{
for (var i in strArray)
{
strArray[i] = strArray[i].trim();
}
oArea.value = strArray.join("");
eval(oArea.value);
}
};
//-->
</
script
>
</
html
>
|