我能做什么,我可以打电话给onclick功能?真的需要帮助,事先谢谢:)
if ($result1 = mysqli_query($con, $SQL1)){
while ($row1=mysqli_fetch_array($result1)) {
echo "
<h1>$row1[Navn]</h1>
<hr>
<div id='Billedinfo'>
<div id='Billed'>
<div id='Hoved'>
<img id='billedet' src='Billeder/$row1[Billed]'>
</div>
<div id='Billederne'>
<img class='Andrebilleder' id='photo1' src='Billeder/$row1[billed1]'onmouseover='hover('photo1')' onmouseout='hoverout('photo1')' onclick='chooser('photo1')'>
<img class='Andrebilleder' id='photo2' src='Billeder/$row1[billed2]' onmouseover='hover('photo2')' onmouseout='hoverout('photo2')' onclick='chooser('photo2')'>
<img class='Andrebilleder' id='photo3' src='Billeder/$row1[billed3]' onmouseover='hover('photo3')' onmouseout='hoverout('photo3')' onclick='chooser('photo3')'>
<img class='Andrebilleder' id='photo4' src='Billeder/$row1[billed4]' onmouseover='hover('photo4')' onmouseout='hoverout('photo4')' onclick='chooser('photo4')'>
<img class='Andrebilleder' id='photo5' src='Billeder/$row1[billed5]' onmouseover='hover('photo5')' onmouseout='hoverout('photo5')' onclick='chooser('photo5')'>
<img class='Andrebilleder' id='photo6' src='Billeder/$row1[billed6]' onmouseover='hover('photo6')' onmouseout='hoverout('photo6')' onclick='chooser('photo6')'>
<img class='Andrebilleder' id='photo7' src='Billeder/$row1[billed7]' onmouseover='hover('photo7')' onmouseout='hoverout('photo7')' onclick='chooser('photo7')'>
<img class='Andrebilleder' id='photo8' src='Billeder/$row1[billed8]' onmouseover='hover('photo8')' onmouseout='hoverout('photo8')' onclick='chooser('photo8')'>
</div>
答案 0 :(得分:1)
插入php变量时也有错误。
将$ row1 [Navn]替换为$ row1 [&#39; Navn&#39;]并将所有php变量替换为相同。
并像这样调用js函数,
onmouseout=\"hoverout('photo8')\"
答案 1 :(得分:0)
您应该查看生成的HTML 非常搞砸了,因为您在其他引号中包含引号而没有任何考虑。
要在同一报价的另一组内包含报价,您需要使用\
转义它。
onmouseover='hover('photo6')'
将成为onmouseover='hover(\'photo6\')'
考虑到你将数组索引称为常量而不是字符串($row1[billed8]
应该是$row1['billed8']
),你也应该得到PHP警告。