Konfermim i nje veprimi ne javascript
August 7th, 2008
Gjate ndertimit te nje aplikacioni web apo dhe faqeje, perdoruesit i japim mundesi te beje veprime mbi te dhena ne nje database, apo objekte te ndryshme. Te gjithe e dime se ne pergjithesi njeresit veprojne pa lexuar shume e pa u mendur, ne menyre automatike, e ne pergjithesi, klikojne pa probelme edhe kur nje buton thote qarte “Elimino”, pa mendur mire se cfare domethenje ka ne te vertete. Normalisht qe ky problem nuk ka nje zgjidhje, por gjithsesi perdoruesi mund te ankohet se fshirja e nje te dhene shume te rendeishme ishte shume e “lehte”.
Le ti japim nje shanc te fundit perdoruesit duke i kerkuar nje konfermim me javascript atehere:
//fillimi i shembullit
if(window.confirm("Doni me te vertete te eliminoni kete element?")){
alert("Ok u leminua");
//u konfermua eliminimi
}else{
alert("Atehere nuk po e elimonoj");
//perdoruesi nderroi mendje
}
//fundi i shembullit



Komentet e fundit