<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <meta http-equiv= "content-type" content= "text/html"; charset=gb2312 "/> <ptml> <pead> <title>Untitled</title> </pead> <body> <s Cript language = javascript> function diff () {var s = f.s1.value; var S1 = F.s2.value; document.write ("s:" + S + "<br>"); document.write ("S1:" + S1 + "<br>"); function sort (s, a) {for (i=0 i<s.length;i++) {A[i] = S.charat (i); return A.sort (); List = sort (s, New Array ()); List1 = sort (S1, new Array ()); var m = 0; var n = 0; var L = new Array (); for (i = 0; i < list.length. i++) {} for (i = 0; i < list1.length; i++) {} j = 0; while (M < list.length && N < list1.length) {if (List[m] < List1[n]) {l[j] = list[m]; if (M < list.length) {m++; } i++; j + +; Continue } if (List[m] > List1[n]) {l[j] = List1[n]; if (n < list1.length) {n++; } i++; j + +; Continue } if (list[m] = = List1[n]) {if (M < list.length) {m++; } if (n < list1.length) {n++; } i++; Continue } if (l.length = 0) alert ("Two strings contain exactly the same characters"); Else alert ("Two strings have different characters, they are:" + "" + L.join (",") + ""); } </script> <form name = "F" > <input type = "text" name = "S1" > <input type = "text" name = "S2" & Gt <input type = "button" name = "Compare" value = "compare" onclick = "diff ()" > </form> </body> </ptml> ;
[Ctrl + A All SELECT Note: If the need to introduce external JS need to refresh to perform]