2012-09-11 19 views
0

這裏是結果從查詢的一部分...Javascript實現完全的形式MSGBOX答案是YES

`Echo '<input type="text" name="amount" style="height:10px;width:15px;font-size:8px;" value="1"> 
<input type="submit" style="height:10px;font-size:6px;" value="Xx" onclick="confirmDeletec(\'items.php?del='.$item['Idi'].'&nr=1\')">'; ` 

這裏是JavaScript函數

function confirmDeletec(delUrl3) { 
    if (confirm("Are you sure you want to delete that item?")) { 
     document.location = delUrl3; 
    } 
    } 

當我點擊按鈕,它問我想要刪除該項目,如果我按是的,它會刪除1的總金額...

現在的問題是我如何使nr =文本框的值(例如:items.php?del = 43 & nr = 5 where textboxva略是5 ...),然後問我是否想刪除...

我試圖做一個形式,但我可以-T使用功能confirmdelete ...

我提到每個MySQL的結果我有一個文本框和一個提交按鈕...

回答

0

純JS的解決方案

變化

onclick="confirmDeletec(

onclick="return confirmDeletec(

現在改變功能

function confirmDeletec(delUrl3) { 
    if (!confirm("Are you sure you want to delete that item?")) { 
     return false; 
    } 
    return true; 
} 

如果你能代替功能使用JQuery,使用下面的代碼

$("#formid").submit(function(e){ 
    if (!confirm("Are you sure you want to delete that item?")) { 
     e.preventDefault(); 
    } 
}); 
+0

我的問題是如何使用刪除一定量的項目一個texbox的數量和一個按鈕提交表單或link.php?itemid&nr = textbox.value –

相關問題