In diesem Artikel wird beschrieben, wie das kürzeste XML -Formatierungs -Tool von JS implementiert wird. Teilen Sie es für Ihre Referenz. Die Details sind wie folgt:
Dies ist das kürzeste XML -Formatierungswerkzeug mit E4X. Leider unterstützt der IE diese bisherige Standardfunktion nicht ...
Bitte führen Sie es in Firefox oder Chrome aus!
1. Der Code ist wie folgt:
Kopieren Sie den Code wie folgt: <html>
<kopf>
<title> Einrückung xml </title>
<script Language = "javaScript" type = "text/javascript" src = "http://code.jquery.com/jquery-latest.js"> </script>
<script Language = "javaScript" type = "text/javaScript; e4x = 1">
$ (function () {
$ ('Schaltfläche'). Click (function () {
$ ('textarea').
});
});
</script>
</head>
<body>
<div>
<textarea rows = "8" cols = "40"> </textArea>
</div>
<Div> <button> Eingeklagter </button> </div>
</body>
</html>
2. Vor dem Formatieren:
3. nach Formatierung:
Ich hoffe, dieser Artikel wird für JavaScript -Programme aller hilfreich sein.