问答详情
源自:7-16 随机数 random()

哪位前辈帮我看下,看看我写的这段代码有没有问题

<!DOCTYPE html>

<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Math </title>

<script type="text/javascript">

    var ran=Math.random(()*10);

    document.write(Math.round(ran));

</script>

</head>

<body>

</body>

</html>


提问者:慕容0727257 2016-06-20 21:38

个回答

  • 慕粉lu51247
    2016-06-20 21:50:32
    已采纳

    <!DOCTYPE html>
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Math </title>
    <script type="text/javascript">
        var ran=Math.random()*10;
    	alert(ran);
        document.write(Math.round(ran));
    </script>
    </head>
    <body>
    </body>
    </html>


  • 慕容0727257
    2016-06-20 21:55:33

    谢谢,已经找到错误点了