单选框(radio)之onclick事件的实现

第一部分:

<table width="410" border="0" align="center" cellpadding="0" cellspacing="0" >
     <tr>
         <td width="26"><input name="db" type="radio" checked="checked" onclick="res(1)"/></td>
         <td width="87" align="left">效率类指标</td>
         <td width="25"><input name="db" type="radio" onclick="res(2)"/></td>
         <td width="93" align="left">卷烟类指标 </td>
         <td width="25"><input name="db" type="radio" onclick="res(3)"/></td>   
         <td width="154" align="left">烟叶类指标</td>
     </tr>
 </table>

 

第二部分:

<script type="text/javascript">

function res(cs)
{  
       var param;
       if(cs == 1)
       {
          param = "one";
       }
       if(cs == 2)
       {
          param = "two";   
       } 
       if(cs == 3)
       {
          param = "three"; 
       }
       $.ajax({
                   url:"<c:url value='/t_sys_kanban/duibiao11/'/>"+param,
                   type: "post",
                   dataType: "text",
                   error: function(){
                   alert("Error loading XML document"); 
     },
     success: function(data)
     {  
             var tab = data;
             document.getElementById("chartdiv11").innerHTML = tab;
     }
 });
 }</script>

 

第三部分:

<div id="chartdiv11">

posted on 2012-08-13 17:13  专注2018  阅读(21292)  评论(0编辑  收藏  举报