 |
|
ASP.Net อยากได้คำสั่ง สร้างกล่องข้อความ ที่มี Yes/No หรือ ตกลง/ไม่ตกลง Java Scrip ครับ |
|
 |
|
|
 |
 |
|

Code (VB.NET)
'*** Button ***'
With Me.btnSubmit
.Attributes.Add("Onclick", "return confirm('Do you want to...?');")
.Style.Add("cursor", "hand")
End With
ASP.NET Attribute.Add
|
 |
 |
 |
 |
Date :
2013-08-22 08:29:10 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบพระคุณครับ ท่านอาจารย์ Win
|
 |
 |
 |
 |
Date :
2013-08-22 19:51:50 |
By :
ละอ่อน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สอบถามเพิ่มเติมครับ จะให้ใส่เงื่อนไขตรงไหนครับ เช่น ถ้ากด Yes ก็ทำการลบ ถ้าตอบ No ก็ไม่ลบ ขอบคุณครับ
if = yes
..ลบข้อมูล
else
ไม่่ลบข้อมูล
end if
|
 |
 |
 |
 |
Date :
2021-08-11 11:58:03 |
By :
ละอ่อน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใน Attribute.aspx เขียนฟังก์ชัน JS เพิ่ม
Code (JavaScript)
function clearOnConfirm() {
if (confirm("Are you sure you want to continue?")) {
document.getElementById("<%=txtInput.ClientID %>").value = '';
return true;
} else {
return false;
}
}
Attribute.aspx.vb
'*** Button ***'
With Me.btnSubmit
.Attributes.Add("Onclick", "return clearOnConfirm();")
.Style.Add("cursor", "hand")
End With
|
 |
 |
 |
 |
Date :
2021-08-11 13:59:01 |
By :
TheGreatGod_of_Death |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|