[json]js 概率计算(简单版)

时间:2021-08-22  来源:js教程  阅读:

核心代码:

//7:3运算
if(Math.ceil(Math.random()*10)>3){
  //占比=7
  alert("7");
  window.location.href="http://www.baidu.com" rel="external nofollow" ;
}else{
  //占比=3
  alert(3);
  widnow.location.href="http://www.jb51.net";
}

通过随机数大小来判断,最好访问哪个网址。大家可以根据自己的需求修改即可。

[json]js 概率计算(简单版)

http://m.bbyears.com/wangyezhizuo/137472.html

推荐访问:json格式化 json在线格式化 js格式化 js刷新当前页面 jsp js保留两位小数
相关阅读 猜你喜欢
本类排行 本类最新