判断数值

<%@ page contentType="text/html;charset=GBK"%>
<%@ page import = "com.sinosoft.consensus.util.DBOperator"%>
<%@ page import = "java.text.SimpleDateFormat"%> 
<%@ page import = "java.text.ParseException"%>   
<%@ page import = "com.sinosoft.consensus.util.ToGBK"%>
<%@ page import = "com.sinosoft.consensus.hotsite.HotSiteBean"%>
<%@ page import = "com.sinosoft.consensus.hotsite.HotSiteInfo"%>
<%@ page import = "java.util.*"%>
<%@include file="../user/currentuserinfo.jsp" %>

<html>
 <head>
  <title>热点站点</title>
   <meta http-equiv="Content-Type" content="text/html; charset=GBK">
  <link href="../style/button.css" rel="stylesheet" type="text/css">
  <link href="../style/main.css" rel="stylesheet" type="text/css">
  <link href="../style/style_zk.css" rel="stylesheet" type="text/css">
  <script type="text/javascript">
   function f( ziduan )
   {
    if(ziduan==document.frm.ziduan.value)
    {
     if(document.frm.sort.value=='dec')
      document.frm.sort.value='asc';
     if(document.frm.sort.value=='asc')
      document.frm.sort.value='dec';
    }
    else
    {
     document.frm.sort.value="asc";
     document.frm.ziduan.value=ziduan;
    }
    document.frm.submit();
   }
   
   function selectSource()
   {
    var spanObj = document.getElementById("filtrInfo");
    var left = spanObj.offsetLeft;
    var top = spanObj.offsetTop;
    var height = spanObj.clientHeight;
  
    window.sourceDeploy(left, top, height, "sourceSel", -60);
   }
   
   function selectAll(objCheckboxes, bChecked)
   {
    if(objCheckboxes.type == "checkbox")
    {
     objCheckboxes.checked = bChecked;
    }
    else
    {
     for(i = 0; i < objCheckboxes.length; i++)
     {
      objCheckboxes[i].checked = bChecked;
     }
    }
   }
   
   function affirmSourceOpe()
   {
    document.all.sourceSel.style.display="none";
   
    var vInfoSourcesVal = "";
    var vInfoSourcesName = "";
   
    var sourceObj = document.all.filtrInfo;
    for(i = 0; i < sourceObj.length; i++)
    {
     if(sourceObj[i].checked)
     {
      var s = sourceObj[i].value;
      var sArr = s.split("|");
      vInfoSourcesVal = vInfoSourcesVal + sArr[0] + "','";
      vInfoSourcesName = vInfoSourcesName + sArr[1] + ",";
     }
    }
    if(!vInfoSourcesVal!='')
     vInfoSourcesVal = vInfoSourcesVal.substring(0, vInfoSourcesVal.length-3);
    vInfoSourcesName = vInfoSourcesName.substring(0, vInfoSourcesName.length-1);
    if(vInfoSourcesVal=='')
    {
     vInfoSourcesVal="all";
     vInfoSourcesName="无信息源";
    }
    document.frm.filtrInfoSourcesName.value = vInfoSourcesName;
    document.frm.filtrInfoSources.value = vInfoSourcesVal;
    
   }
   
   function sourceDeploy(posLeft,posTop,opsHeight,spanId,offset)
   {
    var spanObj = document.getElementById(spanId);
    var left,top,ctrl;
   
    left = posLeft;
    top = posTop;
    spanObj.style.left = (left - offset)  + "px";
    spanObj.style.top = (top + opsHeight - 30) + "px";
    spanObj.style.display="block";
   }
   
  </script>
  <script language="JavaScript" src="../FusionCharts/FusionCharts.js"></script>
  <%
  String filtrInfoSourcesName=request.getParameter("filtrInfoSourcesName");
  String filtrInfoSources=request.getParameter("filtrInfoSources");
  String ziduan=request.getParameter("ziduan");
  String sort=request.getParameter("sort");
  String yell=request.getParameter("yell");
  String ch=request.getParameter("ch");
  String reds=request.getParameter("reds");
  
  
  HotSiteBean hsb=new HotSiteBean();
  HashMap dataList=new HashMap(); 
  dataList=hsb.getHotSiteYZ();
  
  if(ziduan==null)
    ziduan="website";
   if(sort==null)
    sort="dec";
  if(filtrInfoSources==null)
  {
   filtrInfoSources=(String)hsb.getUserHot(userid);
   if(filtrInfoSources==null)
    filtrInfoSources=" ";
  }
  if(filtrInfoSourcesName==null)
  {
   filtrInfoSourcesName=(String)hsb.getWebName(filtrInfoSources);
   if(filtrInfoSourcesName==null)
    filtrInfoSourcesName="无信息源";
  }
  else
   filtrInfoSourcesName=ToGBK.getContent(filtrInfoSourcesName);
  if(yell==null)
   yell=(String)dataList.get("1");
  if(ch==null)
   ch=(String)dataList.get("2");
  if(reds==null)
   reds=(String)dataList.get("3");
  
  
  
  SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");   
   GregorianCalendar gc = new GregorianCalendar();
   
   HashMap databasemap=DBOperator.getDatabaseName();
  String date=df.format(new Date()); 
  Date eDate=null;
  try {
   eDate = df.parse(date);
  } catch (ParseException e) {
   eDate = new Date();
  }      
  gc.setTime(eDate);
  gc.add(Calendar.DAY_OF_YEAR,-1);
  Date yesDate=gc.getTime();
  gc.add(Calendar.DAY_OF_YEAR,-1);
  Date grouDate=gc.getTime();
  
    ArrayList al=new ArrayList();
    ArrayList temp=new ArrayList();
  temp = hsb.getHotBySite(filtrInfoSources,df.format(grouDate),df.format(yesDate));
  al=hsb.getSort( temp,ziduan,sort);
  String name="";
  String grou="";
  String yest="";
  String color="";
  String red="";
  String yellow="";
  String cheng="";
  for( int i = 0 ; i < al.size() ;i++)
  {
   HotSiteInfo hsi=new HotSiteInfo();
   hsi=(HotSiteInfo)al.get(i);
   name=name+"<category label='"+databasemap.get(hsi.getWebsite())+"' />";
   grou=grou+"<set value='"+hsi.getGrounums()+"' />";
   yest=yest+"<set value='"+hsi.getYesnums()+"'";
   int tmp=Integer.parseInt(hsi.getGrounums());
   if(tmp==0)
    tmp=1;
     int tmp2=Integer.parseInt(hsi.getYesnums());
     float tmp3=tmp2/tmp;
   if(tmp3>((Float.parseFloat(reds)+100.0)/100.0))
      color="color='ff0000'";
     else
      if(tmp3>((Float.parseFloat(ch)+100.0)/100.0))
       color="color='ff6100'";
      else
       if(tmp3>((Float.parseFloat(yell)+100.0)/100.0))
        color="color='ffff00'";
    yest=yest+color;
   yest=yest+" />";
   
   red=red+"<set value='"+(int)(tmp*((Float.parseFloat(reds)+100.0)/100.0))+"'color='ff0000' />";
   cheng=cheng+"<set value='"+(int)(tmp*((Float.parseFloat(ch)+100.0)/100.0))+"' color='ff6100' />";
   yellow=yellow+"<set value='"+(int)(tmp*((Float.parseFloat(yell)+100.0)/100.0))+"'color='ffff00' />";
  }
  %>
 </head>
 <body>
  <form name="frm" method="POST" action="hotsite.jsp">
   <span id="sourceSel" style="position:absolute;display:none;position:absolute;z-index:9; width:390px;padding:12px 6px 6px; margin:200px 0 0 90px; font-size:12px;text-align:left;border:solid #fc0;border-width:1px 2px 2px 1px; background:#ffe; color:#333;" >
   <lable><strong>新 闻</strong></lable>
   <div style="DISPLAY: block">
    <table class="tform" style="width: 90%">
    <tr>
    <%
     HashMap map = DBOperator.getDatabaseByType("news");
     Set keySet = map.keySet();
     Iterator iter = keySet.iterator();
     int dbcount = 0;
     while( iter.hasNext() ){
      String key = (String)iter.next();
      String val = (String)map.get(key);
      if(dbcount%2==0 && dbcount!=0){
    %>
     <tr>
    <% } %>
      <td nowrap="true">
       <input type="checkbox" id="filtrInfo" name="filtrInfo" value="<%=key+"|"+val %>" <%=((filtrInfoSources.indexOf(key)>-1)||(filtrInfoSources.equals("all")))?"checked":""%> /><%=val%>
      </td>
    <%  if((dbcount+1)%2==0 || dbcount==map.size()-1){ %>
     </tr>
    <%
      }
      dbcount++;
     }
    %>
    </table>
   </div>
   <br>
   <lable><strong>论 坛</strong></lable>
   <div style="DISPLAY: block">
    <table class="tform" style="width: 90%">
    <tr>
    <%
     map = DBOperator.getDatabaseByType("bbs");
     keySet = map.keySet();
     iter = keySet.iterator();
     dbcount = 0;
     while( iter.hasNext() ){
      String key = (String)iter.next();
      String val = (String)map.get(key);
      if(dbcount%2==0 && dbcount!=0){
    %>
     <tr>
    <% } %>
     <td nowrap="true">
      <input type="checkbox" name="filtrInfo" id = "filtrInfo" value="<%=key+"|"+val %>" <%=((filtrInfoSources.indexOf(key)>-1)||(filtrInfoSources.equals("all")))?"checked":""%> /><%=val%>
     </td>
    <%  if((dbcount+1)%2==0 || dbcount==map.size()-1){ %>
     </tr>
    <%
      }
      dbcount++;
     }
    %>
    </table>
   </div>
   <br>
   <lable><strong>元搜索引擎</strong></lable>
   <div style="DISPLAY: block">
    <table class="tform" style="width: 90%">
    <tr>
    <%
     map = DBOperator.getDatabaseByType("search");
     keySet = map.keySet();
     iter = keySet.iterator();
     dbcount = 0;
     while( iter.hasNext() ){
      String key = (String)iter.next();
      String val = (String)map.get(key);
      if(dbcount%2==0 && dbcount!=0){
    %>
     <tr>
    <% } %>
     <td nowrap="true">
      <input type="checkbox" name="filtrInfo" id = "filtrInfo" value="<%=key+"|"+val %>" <%=((filtrInfoSources.indexOf(key)>-1)||(filtrInfoSources.equals("all")))?"checked":""%> /><%=val%>
     </td>
    <%  if((dbcount+1)%2==0 || dbcount==map.size()-1){ %>
     </tr>
    <%
      }
      dbcount++;
     }
    %>
    </table>
   </div>
   <br>
   全选<input type="checkbox" name="selectAllbox" onClick="selectAll(document.all.filtrInfo, checked)"   />
   <button name="button" id="button" style="width: 80px;" onMouseOver="this.className='buttom2'" onMouseOut="this.className='buttom1'" class="buttom1" onClick="javascript:affirmSourceOpe()"><img src="../images/search.gif" align="absmiddle">&nbsp;确 认</button>
   <br>
   &nbsp;
  </span>
   <table width="100%" border="0" cellspacing="1" cellpadding="0" class="tform">
    <tbody>
     <tr>
      <th nowrap width="20%" >信息源</th>
      <td   width="80%" colspan="6">  
       <input type="text" name="filtrInfoSourcesName" readonly="readonly" size= "70" value="<%=filtrInfoSourcesName%>">
        <input type="hidden" name="filtrInfoSources" value="<%=filtrInfoSources%>">
       <button name="button" id="button" style="width: 80px;" onMouseOver="this.className='buttom2'" onMouseOut="this.className='buttom1'" class="buttom1" onClick="javascript:selectSource()"><img src="../images/search.gif" align="absmiddle">&nbsp;选择</button>
      </td>
     </tr>
     <tr>
      <th>设置阀值</th>
      <td>黄:</td>
      <td align="left" width="20%"><label id="labelObj"></label><select  id="selectObj"  style="position:absolute;width:110px;" 
οnchange=textObj.value=this.options[this.selectedIndex].value  >
                       <OPTION value="10000%" selected>选择邮箱</OPTION> <OPTION
                value=sina.com>sina.com</OPTION> <OPTION
                value=sohu.comsohu.com123456478946>sohu.com1234564789</OPTION> <OPTION
                value=tom.com>tom.com</OPTION> <OPTION
                value=126.com>126.com</OPTION> <OPTION
                value=163.com>163.com</OPTION> <OPTION
                value=yahoo.com.cn>yahoo.com.cn</OPTION> <OPTION
                value=kingsoft.com>kingsoft.com</OPTION></SELECT> <input type="text" id="textObj" οnblur="chkPerc(this)"  style="position:absolute;" ></td>
      <td>橙:</td>
      <td align="left" width="20%"><label id="labelObj1"></label><select  id="selectObj1"  style="position:absolute;width:110px;" 
οnchange=textObj1.value=this.options[this.selectedIndex].value  >
                       <OPTION value="10000%" selected>选择邮箱</OPTION> <OPTION
                value=sina.com>sina.com</OPTION> <OPTION
                value=sohu.comsohu.com123456478946>sohu.com1234564789</OPTION> <OPTION
                value=tom.com>tom.com</OPTION> <OPTION
                value=126.com>126.com</OPTION> <OPTION
                value=163.com>163.com</OPTION> <OPTION
                value=yahoo.com.cn>yahoo.com.cn</OPTION> <OPTION
                value=kingsoft.com>kingsoft.com</OPTION></SELECT> <input type="text" id="textObj1" οnblur="chkPerc(this)" size= "10" style="position:absolute;" ></td>
                <td>红:</td>
      <td align="left" width="20%"><label id="labelObj2"></label><select  id="selectObj2"  style="position:absolute;width:110px;" 
οnchange=textObj2.value=this.options[this.selectedIndex].value  >
                       <OPTION value="10000%" selected>选择邮箱</OPTION> <OPTION
                value=sina.com>sina.com</OPTION> <OPTION
                value=sohu.comsohu.com123456478946>sohu.com1234564789</OPTION> <OPTION
                value=tom.com>tom.com</OPTION> <OPTION
                value=126.com>126.com</OPTION> <OPTION
                value=163.com>163.com</OPTION> <OPTION
                value=yahoo.com.cn>yahoo.com.cn</OPTION> <OPTION
                value=kingsoft.com>kingsoft.com</OPTION></SELECT> <input type="text" id="textObj2" οnblur="chkPerc(this)"  size= "10"  style="position:absolute;" ></td>
      </tr>
      <tr>
       <td colspan="7" align="center"><input type="submit" value="查 看" name="check"  /></td>
      </tr>
    </tbody>
   </table>
   <table width="100%" border="0" cellspacing="1" cellpadding="0" >   
     <tr>
      <td  width="61%" align="center" valign="middle"><table class="tform" > <thead><tr><td><div id="chartdiv" style="width:100%;height:100%;align:center">The chart will appear within this DIV. This text will be replaced by the chart.</div>
           <script type="text/javascript">
             var myChart = new FusionCharts("../FusionCharts/MSColumnLine3D.swf", "myChartId", "600", "400", "0", "0");
              
              myChart.setDataXML("<chart caption='数据对比图' palette='1' showValues='1' formatNumberScale='0' bgColor='f6f6f6'  ><categories><%=name%></categories><dataset seriesName='<%=df.format(grouDate)%>' color='AFD8F8' showValues='0'><%=grou%></dataset><dataset seriesName='<%=df.format(yesDate)%>' color='F6BD0F' showValues='0'><%=yest%></dataset>"+
              "<dataset seriesname='红色阈值' renderAs='Line' color='ff0000' ><%=red%></dataset><dataset seriesname='橙色阈值' renderAs='Line' color='ff6100' ><%=cheng%></dataset><dataset seriesname='黄色阈值' renderAs='Line'  color='ffff00' ><%=yellow%></dataset>"+
               "<styles>"+
               "<definition>"+
               "<style name='myCaptionFont' type='font' font='华文中宋' size='17' color='000000' bold='1' /> "+
               "<style name='mySubCaptionFont' type='font' font='华文中宋' size='20' color='000000' bold='1'/> "+
               "<style name='myLabelsFont' type='font' font='华文中宋' size='12' color='000000'   />  "+
               "<style name='myAxisTitlesFont' type='font' font='华文中宋' size='15'  /> "+
               "<style name='myYaxisValueFont' type='font' font='华文中宋' size='12' color='000000'  />  "+
               "<style name='mydatasFont' type='font' font='华文中宋' size='12' color='000000'  />  "+
               " <style name='myLegendFont' type='font' font='华文中宋' size='12' color='000000'  /> "+
               " <style name='myToolTipFont' type='font' font='华文中宋' size='12' color='000000'/> "+
               "</definition>"+
               "<application>"+
               "<apply  toObject='caption' styles='myCaptionFont' />"+
               " <apply toObject='subcaption' styles='mySubCaptionFont' /> "+
               " <apply toObject='DataLabels' styles='myLabelsFont' /> "+
               " <apply toObject='DATAVALUES' styles='mydatasFont' /> "+
               " <apply toObject='YAXISVALUES' styles='myYaxisValueFont' /> "+
               "<apply toObject='ToolTip' styles='myToolTipFont' /> "+
               " <apply toObject='XAxisName' styles='myAxisTitlesFont' /> "+
               " <apply toObject='Legend' styles='myLegendFont' /> "+
               "</application>"+
               "</styles>"+

               "</chart>");
     
              myChart.render("chartdiv");
           </script></td></tr></thead></table></td>
         <td valign="top">
          <table class="list" align="center">
                     <thead>
                       <tr  valign = "middle">
                         <th ><div align="center" >日信息量对比</div></th>
         </tr>
         </thead>
        </table> 
        <table class="list" align="center">
              <tbody>
          <tr align="center">
           <th class="bl" ><div align="center"><a href="javascript:f('website')"><b>网站名称</b></a></div></th>
           <th><div align="center"><a href="javascript:f('grounums')"><b><%=df.format(grouDate)%></b></a></div></th>
           <th><div align="center"><a href="javascript:f('yesnums')"><b><%=df.format(yesDate)%></b></a></div></th>
           <th class="br" ><div align="center"><a href="javascript:f('incs')"><b>日增长率</b></a></div></th>
         </tr>
         <%
         for( int i = 0 ; i < al.size() ;i++)
         {
          HotSiteInfo hsi=new HotSiteInfo();
          hsi=(HotSiteInfo)al.get(i);
          String fontcolor="";
          int tmp=Integer.parseInt(hsi.getGrounums());
          if(tmp==0)
           tmp=1;
            int tmp2=Integer.parseInt(hsi.getYesnums());
            float tmp3=tmp2/tmp;
          if(tmp3>(Integer.parseInt((String)dataList.get("3"))/100-1))
             fontcolor="color='ff0000'";
            else
             if(tmp3>(Integer.parseInt((String)dataList.get("2"))/100-1))
              fontcolor="color='ff6100'";
             else
              if(tmp3>(Integer.parseInt((String)dataList.get("1"))/100-1))
               fontcolor="color='ffff00'";
          %>
          <tr>
              <td class="bl" ><div align="center"><%=databasemap.get(hsi.getWebsite())%></div></td>
              <td><div align="center"><%=hsi.getGrounums()%></div></td>
              <td><div align="center"><%=hsi.getYesnums()%></div></td>
              <td class="br"><div align="center"><font <%=fontcolor%> size="1"><b><%=hsi.getIncs()%>%</b></font></div></td>
             </tr>
          <%  
         }
         %>
        </tbody>
       </table> 
         </td>
        </tr>
    </tbody>
   </table>
   <input type="hidden" name="ziduan" value="<%=ziduan%>">
   <input type="hidden" name="sort" value="<%=sort%>">
  </form>
 </body>
  <script language="javascript">
function test() {
var selectObj1 = document.getElementById("selectObj");
var textObj1 = document.getElementById("textObj");
var topObj = document.getElementById("labelObj");
var topSize = 0;
var leftSize = topObj.offsetLeft;
while (topObj.offsetParent != null) {
   topSize+=topObj.offsetParent.offsetTop;
   leftSize+=topObj.offsetParent.offsetLeft;
   topObj = topObj.offsetParent;
}
selectObj1.style.width = selectObj1.clientWidth;
textObj1.style.width = selectObj1.clientWidth-18;
try{
selectObj1.style.top = topSize+3;
selectObj1.style.left = leftSize+1;
leftSize += selectObj1.clientWidth;
selectObj1.style.clip="rect(0px, "+leftSize+", "+selectObj1.clientHeight+", "+textObj1.style.width+")";
} catch (e){alert(e);}
}
test();
function test1() {
var selectObj1 = document.getElementById("selectObj1");
var textObj1 = document.getElementById("textObj1");
var topObj = document.getElementById("labelObj1");
var topSize = 0;
var leftSize = topObj.offsetLeft;
while (topObj.offsetParent != null) {
   topSize+=topObj.offsetParent.offsetTop;
   leftSize+=topObj.offsetParent.offsetLeft;
   topObj = topObj.offsetParent;
}
selectObj1.style.width = selectObj1.clientWidth;
textObj1.style.width = selectObj1.clientWidth-18;
try{
selectObj1.style.top = topSize+3;
selectObj1.style.left = leftSize+1;
leftSize += selectObj1.clientWidth;
selectObj1.style.clip="rect(0px, "+leftSize+", "+selectObj1.clientHeight+", "+textObj1.style.width+")";
} catch (e){alert(e);}
}
test1();
function test2() {
var selectObj1 = document.getElementById("selectObj2");
var textObj1 = document.getElementById("textObj2");
var topObj = document.getElementById("labelObj2");
var topSize = 0;
var leftSize = topObj.offsetLeft;
while (topObj.offsetParent != null) {
   topSize+=topObj.offsetParent.offsetTop;
   leftSize+=topObj.offsetParent.offsetLeft;
   topObj = topObj.offsetParent;
}
selectObj1.style.width = selectObj1.clientWidth;
textObj1.style.width = selectObj1.clientWidth-18;
try{
selectObj1.style.top = topSize+3;
selectObj1.style.left = leftSize+1;
leftSize += selectObj1.clientWidth;
selectObj1.style.clip="rect(0px, "+leftSize+", "+selectObj1.clientHeight+", "+textObj1.style.width+")";
} catch (e){alert(e);}
}
test2();

function isDigit(s)
{
var patrn=/^[0-9]{1,3}$/;
if (!patrn.exec(s)) return false
return true
}
function isPercDigit(s)
{
var patrn=/^[0-9]{1,3}%$/;
if (!patrn.exec(s)) return false
return true
}

function chkPerc(textObj)
{
 var v = textObj.value;
 if (v.indexOf('%') == -1)
 {
  if (isDigit(v))
  {
   textObj.value = v+'%';
  }
  else
  {
   alert('请输入有效数值');
   textObj.focus();
  }
 }
 else
 {
  if (!isPercDigit(v))
  {
   alert('请输入有效数值');
   textObj.focus();
  }
 }
}

</script>
</html> 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值