Created
November 6, 2014 03:01
-
-
Save lbp0200/5f7e6a8bf38811079e07 to your computer and use it in GitHub Desktop.
Javascript生成100个随机中文
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<body> | |
<p id="demo">Click the button to display a random number.</p> | |
<button onclick="myFunction()">Try it</button> | |
<script> | |
function myFunction() | |
{ | |
var str=''; | |
for(var i=0;i<100;i++){ | |
eval( "var word=" + '"\\u' + (Math.round(Math.random() * 20901) + 19968).toString(16)+'"'); | |
str+=word; | |
} | |
document.getElementById("demo").innerHTML=str; | |
} | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment