2

这是 google 图表 in.php 的代码:

<html><head>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>            
<script type="text/javascript">       
 google.load('visualization', '1.0', {'packages':['corechart']});           
 google.setOnLoadCallback(drawChart);      
   function drawChart() {       
        var data = new google.visualization.DataTable();          
        data.addColumn('string', 'Topping');         
        data.addColumn('number', 'Slices');         
        data.addRows([  ['Mushrooms', 3],  ['Onions', 1],            
                        ['Olives', 1],  ['Zucchini', 1], ['Pepperoni', 2] ]);          
   var options = {'title':'Pizza I Ate Last Night',    
                       'width':400,  'height':300};  
        var chart = new google.visualization.PieChart(document.getElementById
                    ('chart_div'));} 
 </script>   
 </head>    
 <body>          
 <div id="chart_div"></div></body> </html>

我的页面将其加载到 div 的代码:

<html>
<head>
<script type="text/javascript" src="jquery-1.7.1.min.js"></script> 
<script type="text/javascript" src="https://www.google.com/jsapi"></script>  
<script>
$(document).ready( function () { $('#page').load('in.php');});
</script>
</head>
<body>
<div id=page style="width: 900px; height: 500px;" ></div>
</body>
</html>

in.php 单独工作正常,但不使用 out.php 并且加载 out.php 将在源代码中显示空白页面和错误。提前致谢!!!

4

0 回答 0