var theNum=Math.random();
0<theNum<1

解决方案 »

  1.   

    <script>
    alert(Math.random())
    </script>
      

  2.   

    <table><tr><td id=a></td></tr></table>
    <input value="8080" type=button onclick="ddd()">
    <script language="javascript">
    a.innerText=Math.ceil(Math.random()*10);
    function ddd()
    {
    a.innerText=Math.ceil(Math.random()*10);
    }
    </script>
      

  3.   

    一、Math对象的使用格式Math.方法名()   例如:document.write(Math.random())
    Math.方法名(参数....)   列如:document(Math.min(10,20))
    Math.属性   列如:document.write(Math.PI) 二、Math对象的属性 属性名 说明 
    Math.E 在自然对数下使用欧拉指数 
    Math.PI 圆周率 
    Math.LN2 2的自然对数,即ln2的值 
    Math.LN10 10的自然对数,即ln10的值 
    Math.sort2 2的平方根 
    Math.sort1_2 1/2的平方根 三、Math对象的方法 
    方法名 说明 
    abs(x) 取X的绝对值 
    asin(x) 反正弦 
    acos(x) 反余弦 
    atan(x) 反正切 
    atan2(x,y) x/y弧度的反正切 
    sin(x) x的正弦值 
    cos(x) x的余弦值 
    tan(x) x的正切值 
    ceil(x) 对x向上取整 
    floor(x) 对x向下取整 
    exp(x) 指数函数 
    log(x) 对数 
    max(x,y) 取x,y的最大值 
    min(x,y) 取x,y的最小值 
    pow(x,y) 计算x的y次方 
    random() 产生一个随机数 
    round(x) 四舍五入函数 
    sqrt(x) 平方根