我如何在Javascript代码中使用Href属性 [英] How I Can Use Href Attribute In Javascript Code

查看:102
本文介绍了我如何在Javascript代码中使用Href属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript">
      google.load("visualization", "1", {packages:["corechart"]});
      google.setOnLoadCallback(drawChart);
      function drawChart() {
        var data = google.visualization.arrayToDataTable([
          ['', 'Fill', 'Remaining'],
          ['Form 3',  <?php echo $total; ??>,      <?php echo $remain; ??>],

		
        var options = {
          title: 'Form Data Summary',
		  
          hAxis: {title: 'Form Number', titleTextStyle: {color: '#DC3912'}}
        };

        var chart = new google.visualization.ColumnChart(document.getElementById('chart_div'));
        chart.draw(data, options);
      }
	 
    </script>







以上代码我想给'Form3'上的href =#属性。表示用户点击Form3时打开一个新页面




in the above code i want to give href="#" attribute on 'Form3' .. mean when user click on Form3 a new page open

推荐答案

total; ?? > < ?php echo
total; ??>, <?php echo


仍然存在; ?? > ],


var options = {
title:' 表单数据摘要'

hAxis: {title:' 表格编号',titleTextStyle:{color:' #DC3912'}}
};

var chart = new google.visualization.ColumnChart(document.getElementById( ' chart_div'));
chart.draw(数据,选项);
}

< / script >
remain; ??>], var options = { title: 'Form Data Summary', hAxis: {title: 'Form Number', titleTextStyle: {color: '#DC3912'}} }; var chart = new google.visualization.ColumnChart(document.getElementById('chart_div')); chart.draw(data, options); } </script>







以上代码我想给'Form3'上的href =#属性。意思是当用户点击Form3时打开一个新页面




in the above code i want to give href="#" attribute on 'Form3' .. mean when user click on Form3 a new page open


我会在'chart_div'上添加一个打开所请求窗口的onclick处理程序。



在chart.draw(数据,选项)之后添加以下行;

I would add an onclick handler on 'chart_div' that would open the requested window.

Add the line below after chart.draw(data, options);


这篇关于我如何在Javascript代码中使用Href属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆