senters Posted October 4, 2009 Report Share Posted October 4, 2009 Šeit JS f-ja: <script type="text/javascript"> function apstiprinajums_dzesanai(xxx_id, xxx_nosaukums) { [indent]var answer = confirm("Vai tu patiešām vēlies dzēst " + xxx_nosaukums) if (answer) { alert("Dzēš...") window.location = "main.php?cat=2&dzest_id=" + xxx_id; } else { alert("Atcelts...") }[/indent] } </script> Te PHP fragments, kur šī f-ja tiek pasaukta: <?php $sql="SELECT * FROM tabula WHERE xxx_lietotajs_id = '$lietotajs_id'"; $qry = mysql_query($sql) or die(mysql_error()); while ($rinda = mysql_fetch_array($qry)) { $xxx_id = $rinda["xxx_id"]; $xxx_nosaukums = $rinda["xxx_nosaukums"]; $xxx_cena = $rinda["xxx_cena"]; $xxx_datums = $rinda["xxx_datums"]; $xxx_kategorija = $rinda["xxx_kategorija"]; echo " <tr class='hover_1'> <td><img src='Images/item.png' /></td> <td>".$xxx_datums."</td> <td>".$xxx_nosaukums."</a></td> <td>".$xxx_cena."</td> <td>".$xxx_kategorija."</td> <td> <a onclick='apstiprinajums_dzesanai(".$xxx_id.", ".$xxx_nosaukums."); return false' href='#'><img src='Images/icon_del.png' /></a> </td> </tr>"; } ?> Uzspiežot uz dzēst (icon_del) ikonas nekas nenotiek, skatījos ar FF bug consoli, bet gudrāks nepaliku. Quote Link to comment Share on other sites More sharing options...
briedis Posted October 4, 2009 Report Share Posted October 4, 2009 Tev tur trūkst pēdiņu funkcijas parametriem: apstiprinajums_dzesanai(".$xxx_id.", ".$xxx_nosaukums.") Pareizāk būtu: apstiprinajums_dzesanai(\"".$xxx_id."\", \"".$xxx_nosaukums."\") Quote Link to comment Share on other sites More sharing options...
senters Posted October 4, 2009 Author Report Share Posted October 4, 2009 Nu jā šo jau salaboju, bet paldies par responsi. Quote Link to comment Share on other sites More sharing options...
briedis Posted October 4, 2009 Report Share Posted October 4, 2009 Tad viss strādā? Quote Link to comment Share on other sites More sharing options...
senters Posted October 4, 2009 Author Report Share Posted October 4, 2009 Tieši tā, tagad jau esmu pie citām js problēmām .. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.