多轻多软的雪花啊,在空中飘舞着,追逐着,像—朵朵精巧的白菊。暗黄色的天际中像燃着一团百年都没有澌灭的野火,它肆无忌惮的吞噬着天间彩云,仿佛地狱使者受到差遣,来破坏天际的和谐。
我们先来看下本次源码的效果图
大家可以灵活运用,我们把具体JS代码分享给大家:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>Document</title> <style> #count{ font-size: 20px; color: green; width: 400px; height: 30px; border: 1px solid black; margin: auto; line-height: 30px; text-align: center; } </style> </head> <body> <div id="count"></div> <script> //产生随机数 function count (){ var i=Math.random()*(999999-100000)+100000; var j=parseInt(i,10); j="100000-999999随机产生:"+j; document.getElementById("count").innerHTML= j; } setInterval("count()",100); </script> </body> </html>
如果大家还有更简单的方法,可以在下方的留言区讨论。
本文JS随机数产生代码分享到此结束。成功是别人失败时还在坚持。小编再次感谢大家对我们的支持!