<!doctype html> <html> <head> <meta charset="utf-8"> <title>随机数</title> </head> <body> <script type="text/javascript"> function Randnum(value){ var s=1000; var d=500; if(value==‘b‘){ document.write(s+parseInt(500*Math.random())); }else{ document.write(d+parseInt(500*Math.random())); } } </script> <script>Randnum();</script> </body> </html>
?
效果图:
?
?
原文:http://onestopweb.iteye.com/blog/2264138