未捕获的ReferenceError:未定义[function]

时间:2014-07-11 07:50:02

标签: javascript

我遇到了一个问题,我已经找到了很多解决方案,并没有解决我的问题。我确保ViewDetail()的参数是正确的而不是null。

<?php
if(!isset($_GET['id']))
{
    echo "<script>alert('Unauthorized access!')</script>";
    echo "<script>location='../Index/index.php'</script>";
}
include("../database/database.php");

$dateBefore = date('Y-m-d', strtotime("-7 day"));
$dateAfter = date('Y-m-d', strtotime("+7 day"));

$SQL_Query = "SELECT * FROM tblservice, tblbill, tblcustomer WHERE (Next_Service BETWEEN '".$dateBefore."' AND '".$dateAfter."') AND (Last_Service NOT BETWEEN '".$dateBefore."' AND '".$dateAfter."') AND tblservice.BillID = tblbill.BillID AND tblbill.CustomerIC = tblcustomer.CustomerIC  Order By tblbill.BillID";
$SQL_Result = mysql_query($SQL_Query, $Link);
while($row = mysql_fetch_array($SQL_Result))
{
    $data[] = $row; 
}
?>
<script>
function ViewDetail(var1, var2)
{
    location = '../Customer/Customer Order Detail.php?id=reminder&ic='+var1+'&id='+var2;
}
</script>

<?php
if(mysql_num_rows($SQL_Result)>0)
{   
    ?>
    <div id="scroll">

    <table align="center" width="100%">
    <?php
    for($i=0; $i<mysql_num_rows($SQL_Result); ++$i)
    {
        if($data[$i]['Last_Service'] == '0000-00-00')
        {
            $Last = '-';    
        }
        else
        {
            $Last = $data[$i]['Last_Service'];
        }
    ?>
    <tr>
        <td align="center" width="5%"><?php echo ($i+1)?></td>
        <td align="center" width="15%"><?php echo ucwords(strtolower($data[$i]['Name']))?></td>
        <td align="center" width="15%"><?php echo $data[$i]['HandPhone']?></td>
        <td align="center" width="15%"><?php echo $data[$i]['HomePhone']?></td>
        <td align="center" width="25%"><?php echo ucwords(strtolower($data[$i]['Address'])).", ".$data[$i]['Postcode']." ".ucwords(strtolower($data[$i]['City'])).", ".ucwords(strtolower($data[$i]['State'])).",".ucwords(strtolower($data[$i]['Country'])) ?></td>
        <td align="center" width="15%"><?php echo $Last ?></td>
        <td align="center" width="5%"><input type="button" name="btnView" id="btnView" value="View" onclick="ViewDetail('<?php echo $data[$i]['CustomerIC']?>', '<?php echo $data[$i]['BillID']?>')"/></td>
        <td align="center" width="5%"><input type="button" name="btnDone" id="btnDone" value="Done"/></td>
    </tr>
    <?php   
    }
    ?>
    </table>
    </div>
    <?php
}
else
{
    ?>
    <table align="center" width="100%">
    <tr>
        <td align="center">No report available </td>
    </tr>
    </table>
    <?php
}
?>

此页面由ajax调用。 当我点击“查看”按钮时,Google Chrome会向我抛出“Uncaught ReferenceError:ViewDetail is not defined”。 抱歉我的英语不好,我是新的Stackoverflow,还不熟悉它

0 个答案:

没有答案
相关问题