Skip to content

Instantly share code, notes, and snippets.

@lbp0200
Created November 6, 2014 03:01
Show Gist options
  • Save lbp0200/5f7e6a8bf38811079e07 to your computer and use it in GitHub Desktop.
Save lbp0200/5f7e6a8bf38811079e07 to your computer and use it in GitHub Desktop.
Javascript生成100个随机中文
<!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