Js to ask whether to delete, js to ask to delete
If (confirm ("are you sure you want to delete? ") = True)
On the jsp page, click the delete button. In the displayed dialog box, check whether the code is deleted. How can this code be written?
Use js, onclick = 'confirmdel ();'
Function confirmDel (){
Return confirm ("are you sure you want to delete? ");
}
Js Node Deletion Problems
Set d. item (I). onclick = function (){
Var n = d. item (I );
N. parentNode. remove (n );
}
Change to d. item (I). onclick = function (){
This. parentNode. removeChild (this );
}
My method:
Window. onload = function (){
Var I = 0;
Document. ondblclick = function (){
I ++;
Var o = document. createElement ('div ');
O.style.css Text = 'width: 100px; height: 50px; border: 1px solid # f00; margin-top: 1px ;';
O. innerHTML = I;
Document. body. appendChild (o );
Var d = document. getElementsByTagName ('div ');
For (var j = 0; j <d. length; j ++ ){
D [j]. onclick = function (){
This. parentNode. removeChild (this );
}
}
}
}