未捕获的语法错误意外的令牌}
我有这样的代码:
<?php
session_start();?>
<!DOCTYPE html>
<html>
<head>
<title>Narcis Bet</title>
<meta charset="utf-8">
<link rel="stylesheet" href="css/style.css" type="text/css">
<script type="text/javascript" src="js/script.js"></script>
</head>
<body>
<header>
<div id="top">
<a href="../index.php"><img src="images/logo.png" width="400" height="140" alt="logo"/></a>
<?php
if(!isset($_SESSION['utilizator']))
{
?>
<div id="topright">
<form action="api/login.php" method="POST" id="toprightt">
<input type="text" name="username"/>
<input type="password" name="password"/>
<input type="submit" value="Login"/>
</form>
</div>
<a href="#" id="toprightimg"><img src="images/facebook.png" alt="facebook"/></a>
<a href="#" id="topright">Contact</a>
<a href="#" id="topright">Termeni și condiții</a>
</div>
</header>
<?php
if(isset($_SESSION['eroare']))
{
echo $_SESSION['eroare'];
unset($_SESSION['eroare']);
}
}
else
{
echo "<h1 id="."topright".">Bun venit,".$_SESSION['utilizator']."</h1>";
?>
<form action="api/logout.php" id="toprightl">
<input type="submit" value="Logout"/>
</form>
<nav class="nav">
<ul>
<li><a href="pariuri.php">Pariuri</a></li>
<li><a href="#Section3">Loto</a></li>
<li><a href="#Section2">Despre</a></li>
<li><a href="regulament.php">Regulament</a></li>
</ul>
</nav>
<section class="main">
<table class="tableright" id="talon">
<tr>
<th>Cod</th>
<th>Eveniment</th>
<th>Data</th>
<th>Cota</th>
</tr>
</table>
<table class="table1" >
<thead>
<tr><th colspan="6" class="th1">FOTBAL</th></tr>
<tr>
<th>Cod.</th>
<th>Eveniment</th>
<th>data</th>
<th >1</th>
<th >X</th>
<th >2</th>
</tr>
</thead>
<?php
$handle = @fopen("../res/fotbal.txt", "r");
if ($handle)
{
while (($buffer = fgets($handle, 4096)) !== false)
{
$pariu=json_decode($buffer,true);
echo "<tr>";
echo "<td id='cod'>".$pariu["id"]."</td>";
echo "<td id='ev'>".$pariu['eveniment']."</td>";
echo "<td id='data'>".$pariu['data']."</td>";
echo "<td class='td1' onclick='FUNCTIE(".$pariu["id"].","".$pariu["eveniment"]."","".$pariu["data"]."",'1')>".$pariu['1']."</td>";
echo "<td class='td1' onclick='FUNCTIE(".$pariu["id"].","".$pariu["eveniment"]."","".$pariu["data"]."",'X')>".$pariu['X']."</td>";
echo "<td class='td1' onclick='FUNCTIE(".$pariu["id"].","".$pariu["eveniment"]."","".$pariu["data"]."",'2')>".$pariu['2']."</td>";
/*echo "<td class='td1'><button onclick='FUNCTIE(".$pariu["id"].","".$pariu["eveniment"]."","".$pariu["data"]."",'1')".$pariu['1']."</button></td>";
echo "<td class='td1'><button onclick='FUNCTIE(".$pariu["id"].","".$pariu["eveniment"]."","".$pariu["data"]."",'X')".$pariu['1']."</button></td>";
echo "<td class='td1'><button onclick='FUNCTIE(".$pariu["id"].","".$pariu["eveniment"]."","".$pariu["data"]."",'2')".$pariu['1']."</button></td>";
*/
echo "</tr>";
}
if (!feof($handle))
{
echo "Error: unexpected fgets() failn";
}
fclose($handle);
}
} ?>
</table>
</section>
</body>
</html>
和javascript中的函数:
function FUNCTIE(id,eveniment,data,tip_pariu)
{
var table=document.getElementById('talon');
if(table)
{
table.innerHTML+="<tr><td>"+id+"</td><td>"+eveniment+"</td><td>"+data+"</td><td>"+tip_pariu+"</td><tr>";
}
}
我得到这个错误(未捕获的语法错误意外的令牌})当我按ond函数与td。请帮助我!我不知道为什么我得到这个错误!............... .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ............................
除非它们都是数字,关键字,函数或变量名称,否则应该将您的调用包装在引号中。 所以代码变成了......还有一个'
遗漏了。
... ... ...
echo "<td class='td1' onclick='FUNCTIE("".$pariu["id"]."","".$pariu["eveniment"]."","".$pariu["data"]."",1)'>".$pariu["1"]."</td>";
... ... ...
也许这将工作
链接地址: http://www.djcxy.com/p/8035.html