返回列表 發帖

php include func.php(jquery)

Q:
jqueryfunc.php是include jquery.js
index.php再去call jqueryfunc.php 的getDivXY()
<div>的部份是放在getDivXY()內

Error:
錯誤訊息一直指向$().ready(function(){,(必須要有物件)

這是要作曲線圖,計畫會有三種不同圖型,所以想用function的方式
不曉得是那理沒有對好

souce Code:

index.php
include "../jquery/showXYvalue.php";
        $aR1 = ""; $aR2 = "";
        for ($i=0; $i < 5; $i++){
                if ($aR1 == "")        $aR1 = (rand()%100);
                else                 $aR1 .= "," . (rand()%100);

                if ($aR2 == "")        $aR2 = (rand()%100);
                else                 $aR2 .= "," . (rand()%100);
        }

print getDivXY();


jqueryfunc.php
<script language="javascript" type="text/javascript" src="jquery-1.3.2.min.js"></script>
...

function getDivXy2(){
        $().ready(function(){
                var l1 = [1, 2, 3, 4, 5];
                var l2 = [1, 4, 3, 2, 2.5];
            $.jqplot('chart', [l1, l6], {
                      title:'Default Multiply y axes',
                      legend: {show:true, location: 'nw'}, /*, location: 'nw':nw(lt), n(ct), ne(rt), e(rc), se(rb), s(cb), sw(lb), w(lc) =>小圖框左右邊*/
                        axesDefaults:{useSeriesColor: true},
                series:[{yaxis:'yaxis', color: '#ff4466', lineWidth: 3, label:'good line'}, /*小框說明,線大小,顏色*/
                                {yaxis:'y2axis'}],
                axes:{xaxis: {min: 0, max: 12, numberTicks:13}, yaxis:{padMax:0}, y2axis:{padMax:0} }
            });
        });
}
<?
function getDivXY($divN='',$t1='',$t2='') {
        $msg = "<div id='chart' style='margin-top:20px; margin-left:20px; width:1000px; height:300px;'></div> ";
        print "<script>getDivXy2()</script>";
        return $msg;

}

?>
50 字節以內
不支持自定義 Discuz! 代碼

返回列表 回復 發帖