douhan1860 2014-12-22 12:02
浏览 49

更改多个单选按钮上的图形

I have two radio buttons. When I click on one radio button a graph will be shown and on the other radio button click, a different graph will be shown.

This is what I've tried. But it's not working:

<input type="radio" name="status" id="graph" value="graph" onclick="getValue('operatorgraph');" checked>View Graph for Revenue</input>
    <input type="radio" name="status" id="graph" value="graph" onclick="getValue('hitsgraph');">View Graph for Hits</input>
    {else}
    <input name="status" id="graph" type="hidden"></input> 
    <input name="status" id="report" type="hidden"></input>
    {/if}
   </ul>
   </div>
   <br/>

   <div class="grid_12"> 
   <div class="box"> 
   <div class="header"> 
   <div class="content" style="height: 550px;position:relative"> 
   <div style="height: 500px;" class="chart">
    <div id="chartdiv" align="center" style="position:static;border: 5px solid #3f4041">

        <script type="text/javascript">
            var chart = new FusionCharts("chart/images/FCF_MSLine.swf", "ChartId", "850", "500");
            //chart.setDataURL("datemap.xml");
            chart.setDataXML("{$productXML}");
            chart.render("chartdiv");
        </script>
      </div>
    <div id="chartdiv2" align="center" style="position:static;border: 5px solid #3f4041">

        <script type="text/javascript">
            var chart = new FusionCharts("chart/images/FCF_MSColumn2D.swf", "ChartId", "850", "500");
            //chart.setDataURL("datemap.xml");
            chart.setDataXML("{$productXML2}");
            chart.render("chartdiv2");  

        </script>
      </div>  

Here's my getValue function:

function getValue(attr,step)
{
    if (document.getElementById('graph').checked) 
    {
        type = document.getElementById('graph').value;
    } 
    else if(document.getElementById('report').checked)
    {
        type = document.getElementById('report').value;
    }
    else
    {
        type = 'graph';
    }   

    month = document.getElementById('month').value;  
    Year = document.getElementById('year').value;

if(type == 'graph')
    {
else if(attr == 'operatorgraph')
        {
            var poststring = "event=owg&y="+Year+"&start="+start+"&end="+end;
            //alert (poststring);
            //return false;
            loadXMLDoc(poststring, onOperatorWiseGraph);
        }
        else if(attr == 'hitsgraph')
        {
            var poststring = "event=owg&y="+Year+"&start="+start+"&end="+end;
            //alert (poststring);
            //return false;
            loadXMLDoc(poststring, onOperatorWiseGraphHits);
        }
}
///////////////////////////////////

function onOperatorWiseGraph(response)
{
    //alert(response);
        //document.getElementById('app').value = '';
        var is_chrome = /chrome/i.test( navigator.userAgent );
        if(is_chrome == false)
        {
        var chart = new FusionCharts("chart/images/FCF_MSLine.swf", "ChartId", "840", "400");       
        }
        else
        {
        var chart = new FusionCharts("chart/images/FCF_MSLine.swf", "ChartId", "840", "400");   
        }       
    chart.setDataURL("appc.xml");
    chart.render("chartdiv");
}
function onOperatorWiseGraphHits(response)
{
    //alert(response);
        //document.getElementById('app').value = '';
        var is_chrome = /chrome/i.test( navigator.userAgent );
        if(is_chrome == false)
        {
        var chart = new FusionCharts("chart/images/FCF_MSColumn2D.swf", "ChartId", "840", "400");       
        }
        else
        {
        var chart = new FusionCharts("chart/images/FCF_MSColumn2D.swf", "ChartId", "840", "400");   
        }       
    chart.setDataURL("appc.xml");
    chart.render("chartdiv");
}

Please tell where I'm going wrong?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥30 VMware 云桌面水印如何添加
    • ¥15 用ns3仿真出5G核心网网元
    • ¥15 matlab答疑 关于海上风电的爬坡事件检测
    • ¥88 python部署量化回测异常问题
    • ¥30 酬劳2w元求合作写文章
    • ¥15 在现有系统基础上增加功能
    • ¥15 远程桌面文档内容复制粘贴,格式会变化
    • ¥15 这种微信登录授权 谁可以做啊
    • ¥15 请问我该如何添加自己的数据去运行蚁群算法代码
    • ¥20 用HslCommunication 连接欧姆龙 plc有时会连接失败。报异常为“未知错误”