js换行

yz161616 2011-12-15 08:39:10
以下这段代码,不换行,如何让他一次性自动换行?



(function(e){if(e.xheditor)return false;e.fn.xheditor=function(C){var D=[];this.each(function(){if(e.nodeName(this,"TEXTAREA"))if(C===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(this.xheditor)D.push(this.xheditor);else{var H=/({.*})/.exec(e(this).attr("class"));if(H){try{H=eval("("+H[1]+")")}catch(Va){}C=e.extend({},H,C)}H=new e.xheditor(this,C);if(H.init()){this.xheditor=H;D.push(H)}}});if(D.length===0)D=false;if(D.length===1)D=D[0];return D};var ea=0,Ea=e.browser.version,
B=e.browser.msie,va=e.browser.mozilla,U=e.browser.safari,lb=e.browser.opera,Q=false,wa=true,xa=false,Wa=false,L,ka,la,fa,Y,Fa,ga,Ga,Ha,Ia,V;e("script[src*=xheditor]").each(function(){var C=this.src;if(C.match(/xheditor[^\/]*\.js/i)){V=C.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});var mb={27:"esc",9:"tab",32:"space",13:"enter",8:"backspace",145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",
39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},nb=["#FFFFFF","#CCCCCC","#C0C0C0","#999999","#666666","#333333","#000000","#FFCCCC","#FF6666","#FF0000","#CC0000","#990000","#660000","#330000","#FFCC99","#FF9966","#FF9900","#FF6600","#CC6600","#993300","#663300","#FFFF99","#FFFF66","#FFCC66","#FFCC33","#CC9933","#996633","#663333","#FFFFCC","#FFFF33","#FFFF00","#FFCC00","#999900","#666600","#333300","#99FF99","#66FF99",
"#33FF33","#33CC00","#009900","#006600","#003300","#99FFFF","#33FFFF","#66CCCC","#00CCCC","#339999","#336666","#003333","#CCFFFF","#66FFFF","#33CCFF","#3366FF","#3333FF","#000099","#000066","#CCCCFF","#9999FF","#6666CC","#6633FF","#6600CC","#333399","#330099","#FFCCFF","#FF99FF","#CC66CC","#CC33CC","#993399","#663366","#330033"],ob=[{n:"p",t:"\u666e\u901a\u6bb5\u843d"},{n:"h1",t:"\u6807\u98981"},{n:"h2",t:"\u6807\u98982"},{n:"h3",t:"\u6807\u98983"},{n:"h4",t:"\u6807\u98984"},{n:"h5",t:"\u6807\u98985"},
{n:"h6",t:"\u6807\u98986"},{n:"pre",t:"\u5df2\u7f16\u6392\u683c\u5f0f"},{n:"address",t:"\u5730\u5740"}],pb=[{n:"\u5b8b\u4f53",c:"SimSun"},{n:"\u4eff\u5b8b\u4f53",c:"FangSong_GB2312"},{n:"\u9ed1\u4f53",c:"SimHei"},{n:"\u6977\u4f53",c:"KaiTi_GB2312"},{n:"\u5fae\u8f6f\u96c5\u9ed1",c:"Microsoft YaHei"},{n:"Arial"},{n:"Arial Narrow"},{n:"Arial Black"},{n:"Comic Sans MS"},{n:"Courier New"},{n:"System"},{n:"Times New Roman"},{n:"Tahoma"},{n:"Verdana"}],R=[{n:"xx-small",wkn:"x-small",s:"8pt",t:"\u6781\u5c0f"},
{n:"x-small",wkn:"small",s:"10pt",t:"\u7279\u5c0f"},{n:"small",wkn:"medium",s:"12pt",t:"\u5c0f"},{n:"medium",wkn:"large",s:"14pt",t:"\u4e2d"},{n:"large",wkn:"x-large",s:"18pt",t:"\u5927"},{n:"x-large",wkn:"xx-large",s:"24pt",t:"\u7279\u5927"},{n:"xx-large",wkn:"-webkit-xxx-large",s:"36pt",t:"\u6781\u5927"}],qb=[{s:"\u5de6\u5bf9\u9f50",v:"justifyleft"},{s:"\u5c45\u4e2d",v:"justifycenter"},{s:"\u53f3\u5bf9\u9f50",v:"justifyright"},{s:"\u4e24\u7aef\u5bf9\u9f50",v:"justifyfull"}],rb=[{s:"\u6570\u5b57\u5217\u8868",
v:"insertOrderedList"},{s:"\u7b26\u53f7\u5217\u8868",v:"insertUnorderedList"}],sb={"default":{name:"\u9ed8\u8ba4",width:24,height:24,line:7,list:{smile:"\u5fae\u7b11",tongue:"\u5410\u820c\u5934",titter:"\u5077\u7b11",laugh:"\u5927\u7b11",sad:"\u96be\u8fc7",wronged:"\u59d4\u5c48",fastcry:"\u5feb\u54ed\u4e86",cry:"\u54ed",wail:"\u5927\u54ed",mad:"\u751f\u6c14",knock:"\u6572\u6253",curse:"\u9a82\u4eba",crazy:"\u6293\u72c2",angry:"\u53d1\u706b",ohmy:"\u60ca\u8bb6",awkward:"\u5c34\u5c2c",panic:"\u60ca\u6050",
shy:"\u5bb3\u7f9e",cute:"\u53ef\u601c",envy:"\u7fa1\u6155",proud:"\u5f97\u610f",struggle:"\u594b\u6597",quiet:"\u5b89\u9759",shutup:"\u95ed\u5634",doubt:"\u7591\u95ee",despise:"\u9119\u89c6",sleep:"\u7761\u89c9",bye:"\u518d\u89c1"}}},ma={Cut:{t:"\u526a\u5207 (Ctrl+X)"},Copy:{t:"\u590d\u5236 (Ctrl+C)"},Paste:{t:"\u7c98\u8d34 (Ctrl+V)"},Pastetext:{t:"\u7c98\u8d34\u6587\u672c",h:B?0:1},Blocktag:{t:"\u6bb5\u843d\u6807\u7b7e",h:1},Fontface:{t:"\u5b57\u4f53",h:1},FontSize:{t:"\u5b57\u4f53\u5927\u5c0f",
h:1},Bold:{t:"\u52a0\u7c97 (Ctrl+B)",s:"Ctrl+B"},Italic:{t:"\u659c\u4f53 (Ctrl+I)",s:"Ctrl+I"},Underline:{t:"\u4e0b\u5212\u7ebf (Ctrl+U)",s:"Ctrl+U"},Strikethrough:{t:"\u5220\u9664\u7ebf (Ctrl+S)",s:"Ctrl+S"},FontColor:{t:"\u5b57\u4f53\u989c\u8272",h:1},BackColor:{t:"\u80cc\u666f\u989c\u8272",h:1},SelectAll:{t:"\u5168\u9009 (Ctrl+A)"},Removeformat:{t:"\u5220\u9664\u6587\u5b57\u683c\u5f0f"},Align:{t:"\u5bf9\u9f50",h:1},List:{t:"\u5217\u8868",h:1},Outdent:{t:"\u51cf\u5c11\u7f29\u8fdb (Shift+Tab)",s:"Shift+Tab"},
Indent:{t:"\u589e\u52a0\u7f29\u8fdb (Tab)",s:"Tab"},Link:{t:"\u8d85\u94fe\u63a5 (Ctrl+K)",s:"Ctrl+K",h:1},Unlink:{t:"\u53d6\u6d88\u8d85\u94fe\u63a5"},Img:{t:"\u56fe\u7247",h:1},Flash:{t:"Flash\u52a8\u753b",h:1},Media:{t:"\u591a\u5a92\u4f53\u6587\u4ef6",h:1},Emot:{t:"\u8868\u60c5",s:"ctrl+e",h:1},Table:{t:"\u8868\u683c",h:1},Source:{t:"\u6e90\u4ee3\u7801"},Preview:{t:"\u9884\u89c8"},Print:{t:"\u6253\u5370 (Ctrl+P)",s:"Ctrl+P"},Fullscreen:{t:"\u5168\u5c4f\u7f16\u8f91 (Esc)",s:"Esc"}/*,About:{t:"\u5173\u4e8e xhEditor"}*/},


...全文
335 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
yz161616 2011-12-15
  • 打赏
  • 举报
回复
谢谢!
p2227 2011-12-15
  • 打赏
  • 举报
回复
[Quote=引用 4 楼 yz161616 的回复:]

2楼,有什么方法,一性次搞成这样????????????
[/Quote]http://js.clicki.cc/
仲兴轩 2011-12-15
  • 打赏
  • 举报
回复
http://www.css88.com/tool/js_beautify/
JS格式化
yz161616 2011-12-15
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 hch126163 的回复:]
换行? 还是美化?
[/Quote]

换行,像2楼那样。
yz161616 2011-12-15
  • 打赏
  • 举报
回复
2楼,有什么方法,一性次搞成这样????????????
咸鱼boris 2011-12-15
  • 打赏
  • 举报
回复

(function(e) {
if (e.xheditor)
return false;
e.fn.xheditor = function(C) {
var D = [];
this.each(function() {
if (e.nodeName(this, "TEXTAREA"))
if (C === false) {
if (this.xheditor) {
this.xheditor.remove();
this.xheditor = null
}
} else if (this.xheditor)
D.push(this.xheditor);
else {
var H = /({.*})/.exec(e(this).attr("class"));
if (H) {
try {
H = eval("(" + H[1] + ")")
} catch (Va) {
}
C = e.extend({}, H, C)
}
H = new e.xheditor(this, C);
if (H.init()) {
this.xheditor = H;
D.push(H)
}
}
});
if (D.length === 0)
D = false;
if (D.length === 1)
D = D[0];
return D
};
var ea = 0, Ea = e.browser.version, B = e.browser.msie, va = e.browser.mozilla, U = e.browser.safari, lb = e.browser.opera, Q = false, wa = true, xa = false, Wa = false, L, ka, la, fa, Y, Fa, ga, Ga, Ha, Ia, V;
e("script[src*=xheditor]").each(function() {
var C = this.src;
if (C.match(/xheditor[^\/]*\.js/i)) {
V = C.replace(/[\?#].*$/, "").replace(/(^|[\/\\])[^\/]*$/, "$1");
return false
}
});
var mb = {
27 : "esc",
9 : "tab",
32 : "space",
13 : "enter",
8 : "backspace",
145 : "scroll",
20 : "capslock",
144 : "numlock",
19 : "pause",
45 : "insert",
36 : "home",
46 : "del",
35 : "end",
33 : "pageup",
34 : "pagedown",
37 : "left",
38 : "up",
39 : "right",
40 : "down",
112 : "f1",
113 : "f2",
114 : "f3",
115 : "f4",
116 : "f5",
117 : "f6",
118 : "f7",
119 : "f8",
120 : "f9",
121 : "f10",
122 : "f11",
123 : "f12"
}, nb = [ "#FFFFFF", "#CCCCCC", "#C0C0C0", "#999999", "#666666", "#333333",
"#000000", "#FFCCCC", "#FF6666", "#FF0000", "#CC0000", "#990000",
"#660000", "#330000", "#FFCC99", "#FF9966", "#FF9900", "#FF6600",
"#CC6600", "#993300", "#663300", "#FFFF99", "#FFFF66", "#FFCC66",
"#FFCC33", "#CC9933", "#996633", "#663333", "#FFFFCC", "#FFFF33",
"#FFFF00", "#FFCC00", "#999900", "#666600", "#333300", "#99FF99",
"#66FF99", "#33FF33", "#33CC00", "#009900", "#006600", "#003300",
"#99FFFF", "#33FFFF", "#66CCCC", "#00CCCC", "#339999", "#336666",
"#003333", "#CCFFFF", "#66FFFF", "#33CCFF", "#3366FF", "#3333FF",
"#000099", "#000066", "#CCCCFF", "#9999FF", "#6666CC", "#6633FF",
"#6600CC", "#333399", "#330099", "#FFCCFF", "#FF99FF", "#CC66CC",
"#CC33CC", "#993399", "#663366", "#330033" ], ob = [ {
n : "p",
t : "\u666e\u901a\u6bb5\u843d"
}, {
n : "h1",
t : "\u6807\u98981"
}, {
n : "h2",
t : "\u6807\u98982"
}, {
n : "h3",
t : "\u6807\u98983"
}, {
n : "h4",
t : "\u6807\u98984"
}, {
n : "h5",
t : "\u6807\u98985"
}, {
n : "h6",
t : "\u6807\u98986"
}, {
n : "pre",
t : "\u5df2\u7f16\u6392\u683c\u5f0f"
}, {
n : "address",
t : "\u5730\u5740"
} ], pb = [ {
n : "\u5b8b\u4f53",
c : "SimSun"
}, {
n : "\u4eff\u5b8b\u4f53",
c : "FangSong_GB2312"
}, {
n : "\u9ed1\u4f53",
c : "SimHei"
}, {
n : "\u6977\u4f53",
c : "KaiTi_GB2312"
}, {
n : "\u5fae\u8f6f\u96c5\u9ed1",
c : "Microsoft YaHei"
}, {
n : "Arial"
}, {
n : "Arial Narrow"
}, {
n : "Arial Black"
}, {
n : "Comic Sans MS"
}, {
n : "Courier New"
}, {
n : "System"
}, {
n : "Times New Roman"
}, {
n : "Tahoma"
}, {
n : "Verdana"
} ], R = [ {
n : "xx-small",
wkn : "x-small",
s : "8pt",
t : "\u6781\u5c0f"
}, {
n : "x-small",
wkn : "small",
s : "10pt",
t : "\u7279\u5c0f"
}, {
n : "small",
wkn : "medium",
s : "12pt",
t : "\u5c0f"
}, {
n : "medium",
wkn : "large",
s : "14pt",
t : "\u4e2d"
}, {
n : "large",
wkn : "x-large",
s : "18pt",
t : "\u5927"
}, {
n : "x-large",
wkn : "xx-large",
s : "24pt",
t : "\u7279\u5927"
}, {
n : "xx-large",
wkn : "-webkit-xxx-large",
s : "36pt",
t : "\u6781\u5927"
} ], qb = [ {
s : "\u5de6\u5bf9\u9f50",
v : "justifyleft"
}, {
s : "\u5c45\u4e2d",
v : "justifycenter"
}, {
s : "\u53f3\u5bf9\u9f50",
v : "justifyright"
}, {
s : "\u4e24\u7aef\u5bf9\u9f50",
v : "justifyfull"
} ], rb = [ {
s : "\u6570\u5b57\u5217\u8868",
v : "insertOrderedList"
}, {
s : "\u7b26\u53f7\u5217\u8868",
v : "insertUnorderedList"
} ], sb = {
"default" : {
name : "\u9ed8\u8ba4",
width : 24,
height : 24,
line : 7,
list : {
smile : "\u5fae\u7b11",
tongue : "\u5410\u820c\u5934",
titter : "\u5077\u7b11",
laugh : "\u5927\u7b11",
sad : "\u96be\u8fc7",
wronged : "\u59d4\u5c48",
fastcry : "\u5feb\u54ed\u4e86",
cry : "\u54ed",
wail : "\u5927\u54ed",
mad : "\u751f\u6c14",
knock : "\u6572\u6253",
curse : "\u9a82\u4eba",
crazy : "\u6293\u72c2",
angry : "\u53d1\u706b",
ohmy : "\u60ca\u8bb6",
awkward : "\u5c34\u5c2c",
panic : "\u60ca\u6050",
shy : "\u5bb3\u7f9e",
cute : "\u53ef\u601c",
envy : "\u7fa1\u6155",
proud : "\u5f97\u610f",
struggle : "\u594b\u6597",
quiet : "\u5b89\u9759",
shutup : "\u95ed\u5634",
doubt : "\u7591\u95ee",
despise : "\u9119\u89c6",
sleep : "\u7761\u89c9",
bye : "\u518d\u89c1"
}
}
}, ma = {
Cut : {
t : "\u526a\u5207 (Ctrl+X)"
},
Copy : {
t : "\u590d\u5236 (Ctrl+C)"
},
Paste : {
t : "\u7c98\u8d34 (Ctrl+V)"
},
Pastetext : {
t : "\u7c98\u8d34\u6587\u672c",
h : B ? 0 : 1
},
Blocktag : {
t : "\u6bb5\u843d\u6807\u7b7e",
h : 1
},
Fontface : {
t : "\u5b57\u4f53",
h : 1
},
FontSize : {
t : "\u5b57\u4f53\u5927\u5c0f",
h : 1
},
Bold : {
t : "\u52a0\u7c97 (Ctrl+B)",
s : "Ctrl+B"
},
Italic : {
t : "\u659c\u4f53 (Ctrl+I)",
s : "Ctrl+I"
},
Underline : {
t : "\u4e0b\u5212\u7ebf (Ctrl+U)",
s : "Ctrl+U"
},
Strikethrough : {
t : "\u5220\u9664\u7ebf (Ctrl+S)",
s : "Ctrl+S"
},
FontColor : {
t : "\u5b57\u4f53\u989c\u8272",
h : 1
},
BackColor : {
t : "\u80cc\u666f\u989c\u8272",
h : 1
},
SelectAll : {
t : "\u5168\u9009 (Ctrl+A)"
},
Removeformat : {
t : "\u5220\u9664\u6587\u5b57\u683c\u5f0f"
},
Align : {
t : "\u5bf9\u9f50",
h : 1
},
List : {
t : "\u5217\u8868",
h : 1
},
Outdent : {
t : "\u51cf\u5c11\u7f29\u8fdb (Shift+Tab)",
s : "Shift+Tab"
},
Indent : {
t : "\u589e\u52a0\u7f29\u8fdb (Tab)",
s : "Tab"
},
Link : {
t : "\u8d85\u94fe\u63a5 (Ctrl+K)",
s : "Ctrl+K",
h : 1
},
Unlink : {
t : "\u53d6\u6d88\u8d85\u94fe\u63a5"
},
Img : {
t : "\u56fe\u7247",
h : 1
},
Flash : {
t : "Flash\u52a8\u753b",
h : 1
},
Media : {
t : "\u591a\u5a92\u4f53\u6587\u4ef6",
h : 1
},
Emot : {
t : "\u8868\u60c5",
s : "ctrl+e",
h : 1
},
Table : {
t : "\u8868\u683c",
h : 1
},
Source : {
t : "\u6e90\u4ee3\u7801"
},
Preview : {
t : "\u9884\u89c8"
},
Print : {
t : "\u6253\u5370 (Ctrl+P)",
s : "Ctrl+P"
},
Fullscreen : {
t : "\u5168\u5c4f\u7f16\u8f91 (Esc)",
s : "Esc"
}
}
})();


是这样吗?
hch126163 2011-12-15
  • 打赏
  • 举报
回复
换行? 还是美化?

87,921

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧