Admin
| Tiêu đề: Code viết chữ ngược Tue Apr 26, 2011 10:52 am | |
| Dán vào notepad save lại thành htm hay html - Code:
-
<html>
<head> <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"> <title>Blog thủ thuật | Viết chữ ngược </title> </head>
<body> <script language="JavaScript"> function flip() { var result = flipString(document.getElementById("original").val ue.toLowerCase()); document.getElementById("flipped").value = result; }
function flipString(aString) { var last = aString.length - 1; //Thanks to Brook Monroe for the //suggestion to use Array.join var result = new Array(aString.length) for (var i = last; i >= 0; --i) { var c = aString.charAt(i) var r = flipTable[c] result[last - i] = r != undefined ? r : c } return result.join('') }
var flipTable = { a : '\u0250', b : 'q', c : '\u0254', //open o -- from pne d : 'p', e : '\u01DD', f : '\u025F', //from pne g : '\u0183', h : '\u0265', i : '\u0131', //from pne j : '\u027E', k : '\u029E', //l : '\u0283', m : '\u026F', n : 'u', r : '\u0279', t : '\u0287', v : '\u028C', w : '\u028D', y : '\u028E', '.' : '\u02D9', '[' : ']', '(' : ')', '{' : '}', '?' : '\u00BF', //from pne '!' : '\u00A1', "\'" : ',', '<' : '>', '_' : '\u203E', '\\' : '/', ';' : '\u061B', '\u203F' : '\u2040', '\u2045' : '\u2046', '\u2234' : '\u2235' }
for (i in flipTable) { flipTable[flipTable[i]] = i }
</script> <center> <b> <a target="_self" href="http://www.blogthuthuat.com/">http://www.blogthuthuat.com</a> </b> <br> <table border="0" id="table1" cellpadding="20" style="border:1px dotted #CCCCCC; padding:3px"> <tr> <td><font color="#0000ff"><b>Nào chúng ta cùng viết chữ ngược</b> </font> <img src="http://www.blogthuthuat.com/wp-includes/images/smilies/icon_razz.gif" mce_src="http://www.blogthuthuat.com/wp-includes/images/smilies/icon_razz.gif" alt="Razzberry" title="Razzberry" border="0"><p>Đoạn cần chuyển: </p> <p align="center"> <textarea style = "font-family: Arial Unicode MS, Batang;" rows="5" cols="50" id = "original" onkeyup="flip()" name="S1"></textarea></p> <p align="center"><input value="Chuyển" onclick="flip()" type="button" /></p> <p>Chữ ngược nè:</p> <p align="center"> <textarea style = "font-family: Arial Unicode MS, Batang;" rows="5" cols="50" id ="flipped" name="S2"></textarea> </p> </td> </tr> </table>
</center> </body>
</html> |
|