1、数学函数详解
<!doctype html> <html> <head> <!--声明当前页面的编码集:charset=gbk,gb2312(中文编码),utf-8国际编码--> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <!--当前页面的三要素--> <title>数学函数</title> <meta name="Keywords" content="关键词,关键词"> <meta name="description" content=""> <script type="text/javascript" src="sgutil.js"></script> </head> <body> <h1 id="colorCard">色卡一:李飘水</h1> <h1 id="colorCard2">色卡二:李飘水</h1> <script type="text/javascript"> //Math的常用方法 //1.Math.abs(data):求data的绝对值 //2.Math.sqrt(data):求data的平方根 //3.Math.pow(x,y):求x的y次方 //4.Math.max(x1,x2,x3,...,xn):求x元素中的最大值 //5.Math.min(x1,x2,x3,...,xn):求x元素中的最小值 //6.Math.floor(data):求小于等于data的最大整数 //7.Math.ceil(data):求大于等于data的最小整数 //8.Math.round(data):求四舍五入后的整数 //9.Math.random():求大于0,且小于1的随机数 console.log("Math.abs(-12)="+Math.abs(-12)); //12 console.log("Math.sqrt(2)="+Math.sqrt(2)); //1.414 console.log("Math.pow(2,3)="+Math.pow(2,3)); //8 console.log("Math.max(100,3,20)="+Math.max(100,3,20)); //100 console.log("Math.min(100,3,20)="+Math.min(100,3,20)); //3 console.log("Math.floor(12.85)="+Math.floor(12.85)); //12 console.log("Math.ceil(12.35)="+Math.ceil(12.35)); //13 console.log("Math.random()="+Math.random()); console.log("Math.round(12.47)="+Math.round(12.47)); //12 console.log("Math.round(12.57)="+Math.round(12.57)); //13 //返回start至end的随机数 function rangeRandom(start, end) { return Math.floor(Math.random()*(end-start+1))+start; } /* setInterval(function() { console.log(rangeRandom(0, 5)); },1000); */ //方案一色卡 function randomColor() { var r = Math.floor(Math.random()*256); var g = Math.floor(Math.random()*256); var b = Math.floor(Math.random()*256); return "rgb("+r+","+g+","+b+")"; //IE7不支持rgb } //调用方案一色卡 setInterval(function() { var colorCardDom = document.getElementById("colorCard"); colorCardDom.style.color = randomColor(); },1000); //方案二色卡 function randomColor2() { //将0-255的随机整数转换成十六进制数 var r = Math.floor(Math.random()*256).toString(16); var g = Math.floor(Math.random()*256).toString(16); var b = Math.floor(Math.random()*256).toString(16); //如果转换后的十六进制数不足两位,则在前面补0 if(r.length < 2) { r = "0" + r; } if(g.length < 2) { g = "0" + g; } if(b.length < 2) { b = "0" + b; } return "#"+r+g+b; } //调用方案二的色卡 setInterval(function() { var colorCardDom = document.getElementById("colorCard2"); colorCardDom.style.color = randomColor2(); },1000); </script> </body> </html>
相关推荐
delphi 数学函数 MathFunctions
高一数学函数解析汇报式、定义域、值域解题方法含问题详解.doc
高一数学函数解析式、定义域、值域解题方法含答案.doc
江苏省无锡新领航教育咨询有限公司2013届高三数学 函数解析式求法课前巩固提高(教师版)
数学函数 详解 ,内容全面,讲解清晰。vc中各种数学函数都有
经典数学函数程序,可用于相关的数学方面的研究
VC数学函数用法详解.doc
深入详解c语言中的各种数学函数,让你快速精通c语言编程。
中考数学一次函数解析式题型大全
详细列出了Excel2003常用数学函数以及使用方法举例。
本篇文章对MySQL的数学函数进行了详细的介绍。需要的朋友参考下
同济高等数学函数与极限习题及解析PPT课件.pptx
这是一款数学函数曲线编辑器,c++开发,函数解析使用了自己开发的脚本语言minscript。 编辑器支持以下类型的函数曲线。 MT_Normal ,//一般方程 MT_Implicit ,//参数方程 MT_Polar ,//极坐标方程 MT_UVsurface...
高中一年级数学函数经典题目和答案解析.doc
高中数学函数定义域与值域问题详解.ppt
八年级下数学函数练习题集和答案解析.doc
高中数学函数的定义域与值域问题详解.ppt
高中数学函数的单调性及最值习题及详解.doc
综上所述,这个数学函数绘图软件是一个功能强大、用户友好的系统,它不仅能够提供丰富的图形效果和交互式可视化,还能够通过深度学习和计算机视觉技术支持对复杂数学函数的解析和绘制。对于学生、教师和研究人员来说...