⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 java.js

📁 javascript的一个图表显示源码
💻 JS
字号:
// JavaScript Document
window.onload=function()
{
document.getElementById("info").style.height="0px";
document.getElementById("info").style.marginTop="400px";
showmore("b1");
showmore("b2");
showmore("b3");
showmore("b4");
showmore("b5");
showmore("b6");
showmore("b7");
showmore("b8");
showmore("b9");
showmore("b10");
showmore("b11");
showmore("b12");
}

var alls=0;
var maxs=0;
var mins=0;

function showme(idname)
{
        var heights=parseInt(document.getElementById("info").style.height);
        var tops=parseInt(document.getElementById("info").style.marginTop);
	document.getElementById("thenum").firstChild.nodeValue=document.getElementById(idname).firstChild.firstChild.nodeValue;
	document.getElementById("pronames").firstChild.nodeValue=document.getElementById(idname).parentNode.title;
	var nows=new Date();
	var years=nows.getYear().toString();
	var months=(nows.getMonth()+1).toString();
	var days=nows.getDate().toString();
	var hours=nows.getHours().toString();
	if(parseInt(hours)<10)
	hours="0"+hours;
	var minutes=nows.getMinutes().toString();
	if(parseInt(minutes)<10)
	minutes="0"+minutes;
	var seconds=nows.getSeconds().toString();
	if(parseInt(seconds)<10)
	seconds="0"+seconds;
	document.getElementById("times").firstChild.nodeValue=years+"-"+months+"-"+days+"  "+hours+":"+minutes+":"+seconds;
	if(document.getElementById(idname).firstChild.firstChild.nodeValue=="null")
	document.getElementById("percents").firstChild.nodeValue="null";	
	else
	{
	var ones=parseInt(document.getElementById(idname).firstChild.firstChild.nodeValue);
	document.getElementById("percents").firstChild.nodeValue=Math.round((ones/alls)*10000)/100+"%";	
	}
	if(heights<100){
            heights+=6;
            document.getElementById("info").style.height=(heights)+"px";
            document.getElementById("info").style.marginTop=(400-heights)+"px";
            setTimeout("showme('"+idname+"')",10);
        }
}


function showmore(idname)
{
document.getElementById(idname).onmouseover=function()
{
if(this.firstChild.firstChild.nodeValue!="null")
{
this.style.background="#3c7aba";
/*this.firstChild.style.color="green";*/
for(var i=0;i<10;i++)
{
if(parseInt(document.getElementById("a"+(i+1)).firstChild.nodeValue)<=parseInt(this.firstChild.firstChild.nodeValue))
{
document.getElementById("a"+(i+1)).style.color="yellow";	
}
}
}
}
document.getElementById(idname).onmouseout=function()
{	
if(this.firstChild.firstChild.nodeValue!="null")
{
this.style.background="URL(f.jpg)";
/*this.firstChild.style.color="#003399";*/
for(var i=0;i<10;i++)
{
document.getElementById("a"+(i+1)).style.color="white";
}
}
}
document.getElementById(idname).onclick=function()
{
showme(idname);
}
}


function closes()
{
 var heights=parseInt(document.getElementById("info").style.height);
        var tops=parseInt(document.getElementById("info").style.marginTop);
        if(heights>0){
            heights-=6;
            document.getElementById("info").style.height=(heights)+"px";
            document.getElementById("info").style.marginTop=(400-heights)+"px";
            setTimeout("closes()",10);
        }	
}


function change()
{
shows();
}


function shows()
{
var num=new Array();
var numshow=new Array();
for(var i=0;i<12;i++)
{
num[i]=document.getElementById("bb"+(i+1)).value;
document.getElementById("c"+(i+1)).style.color="#003399";
if(num[i]==null||num[i]=="")
{
document.getElementById("c"+(i+1)).firstChild.nodeValue="null";
document.getElementById("c"+(i+1)).style.color="green";
num[i]="0";
}
else
document.getElementById("c"+(i+1)).firstChild.nodeValue=num[i];
alls+=parseInt(num[i]);
}
maxs=Math.max(num[0],num[1],num[2],num[3],num[4],num[5],num[6],num[7],num[8],num[9],num[10],num[11]);
mins=Math.min(num[0],num[1],num[2],num[3],num[4],num[5],num[6],num[7],num[8],num[9],num[10],num[11]);
for(var i=0;i<12;i++)
{
if(parseInt(num[i])==maxs||parseInt(num[i])==mins)
document.getElementById("c"+(i+1)).style.color="red";
}

if(document.getElementById("auto").checked)
{
document.getElementById("cmaxnum").value=maxs+(maxs/400)*40;
document.getElementById("tips").firstChild.nodeValue="注意:自动模式下将无法进行手动调整";
}

var cmaxnums=parseInt(document.getElementById("cmaxnum").value);
for(var i=0;i<10;i++)
{
document.getElementById("a"+(i+1)).firstChild.nodeValue=Math.ceil((cmaxnums/10)*(10-i));	
}
var maxnum=parseInt(document.getElementById("a1").firstChild.nodeValue);
for(var i=0;i<12;i++)
{
document.getElementById("b"+(i+1)).style.height=(Math.ceil(parseInt(num[i])/(maxnum/400)))+"px";
document.getElementById("b"+(i+1)).style.marginTop=(400-(parseInt(document.getElementById("b"+(i+1)).style.height))+"px");	
}
/*for(var i=0;i<12;i++)
{
numshow[i]=parseInt(num[i]);
}*/
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -