<input type="button" value="123" onclick="randomvalue(2,10)">function randomvalue(low, high) {alert(Math.floor(Math.random() * (1 + high - low) + low));}

解决方案 »

  1.   

    如果要在数据库中的1000条记录随机取数,怎么处理啊??(jascript和数据库的关系怎么处理)
      

  2.   

    jascript和数据库的关系怎么处理?/
    你说的不明白呀,jascript和数据库有什么关系呢?一个前台,一个后台
      

  3.   

    function randomvalue(low, high) {//alert(Math.floor(Math.random() * (1 + high - low) + low));
       return Math.floor(Math.random() * (1 + high - low) + low);
    }var a=randomvalue(1,10);
    alert(a);
      

  4.   

    数据库中的1000条记录随机取一条,显示到网页上??如果是这种情况你要在后台生成随机数;如 PHP
    用PHP生成一个随机数传到取值的函数,这都在后台function getavalue(randomnum)(
    ...
       select * ,rownum from table  where rownum ='randomnum'
    ...
    }
      

  5.   

    up========================================
    http://peipei3000.jishuqi.com/reg.asp
    http://www.goofar.com/?ID=634664011139
    ========================================