อยากได้โค๊ด jQuery หรือ Ajax ที่เป็นเงื่อนไขของการเลือกปุ่ม radio แล้วรูปภาพจะเปลี่ยนไปตามสถานะที่เราเลือก (มีรูปภาพตัวอย่างให้ชมครับ)
เงื่อนไขตัวอย่างประมาณนี้ครับ
- ถ้าเลือกปุ่ม radio (image1) แล้วในกรอบเส้นสีน้ำเงินจะเปลี่ยนเป็น (image1)เพื่อแสดงโชว์ หมายถึง เปลี่ยนไปตามที่เลือก radio เอาไว้
- ถ้าเราเลือกรูปภาพ (image1) + กับแสดงรูปภาพที่เลือกไว้ แล้วเราสามารถส่งค่า POST หรือ GET ไปยังอีกเพจเพื่อทำการ Insert ฐานข้อมูลได้ป่าวครับ
ตัวอย่าง : การเลือกปุ่ม radio (image1) และ ตัวอย่าง : การเลือกปุ่ม radio (image2)
อยากได้โค๊ด jQuery หรือ Ajax ที่เป็นเงื่อนไขของการเลือกปุ่ม radio แล้วรูปภาพจะเป
Moderator: mindphp
-
- PHP Newbie
- Posts: 2
- Joined: 08/08/2012 4:02 pm
อยากได้โค๊ด jQuery หรือ Ajax ที่เป็นเงื่อนไขของการเลือกปุ่ม radio แล้วรูปภาพจะเป
- Attachments
-
- ตัวอย่าง : การเลือกปุ่ม radio (image1) และ ตัวอย่าง : การเลือกปุ่ม radio (image2)
- image12.jpg (28.07 KiB) Viewed 3961 times
- mindphp
- ผู้ดูแลระบบ MindPHP
- Posts: 27183
- Joined: 22/09/2008 6:18 pm
- Contact:
Re: อยากได้โค๊ด jQuery หรือ Ajax ที่เป็นเงื่อนไขของการเลือกปุ่ม radio แล้วรูปภาพจะเป
เขียน jQuery คร่าวๆ
ศึกษาเพิ่มเติมได้ที่หมวด
https://www.mindphp.com/forums/viewforum.php?f=25
Code: Select all
$( ".radioid" ).click( function() {
$.ajax({
url: \'ajax.php?id=\'+ $(this).attr(\'id\'),
success: function(data) {
$('.result_img').html(data); // จะให้แสดงอะไรใส่ลงไปในนี้ .result_ads
}
});
https://www.mindphp.com/forums/viewforum.php?f=25
ติดตาม VDO: http://www.youtube.com/c/MindphpVideoman
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
ติดตาม FB: https://www.facebook.com/pages/MindphpC ... 9517401606
หมวดแชร์ความรู้: https://www.mindphp.com/forums/viewforum.php?f=29
รับอบรม และพัฒนาระบบ: https://www.mindphp.com/forums/viewtopic.php?f=6&t=2042
-
- PHP Newbie
- Posts: 2
- Joined: 08/08/2012 4:02 pm
Re: อยากได้โค๊ด jQuery หรือ Ajax ที่เป็นเงื่อนไขของการเลือกปุ่ม radio แล้วรูปภาพจะเป
ขอบคุณสำหรับโค๊ดนะครับ แต่ผมใส่โค๊ดไม่ถูกครับ รบกวนช่วยหน่อยนะครับ
ผมทำแบบฟอร์มไว้ให้แล้วครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="329" height="288" border="1">
<tr>
<td height="254" colspan="3"><img src="" width="320" height="250" alt="" /></td>
</tr>
<tr>
<td width="102" height="26"><input type="radio" name="radio" id="image1" value="image1" />
<label for="image1">image1</label></td>
<td width="102"><input type="radio" name="radio" id="image2" value="image2" />
<label for="image2">image2</label></td>
<td width="102"><input type="radio" name="radio" id="image3" value="image3" />
<label for="image3">image3</label></td>
</tr>
</table>
</form>
</body>
</html>
ผมทำแบบฟอร์มไว้ให้แล้วครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<form id="form1" name="form1" method="post" action="">
<table width="329" height="288" border="1">
<tr>
<td height="254" colspan="3"><img src="" width="320" height="250" alt="" /></td>
</tr>
<tr>
<td width="102" height="26"><input type="radio" name="radio" id="image1" value="image1" />
<label for="image1">image1</label></td>
<td width="102"><input type="radio" name="radio" id="image2" value="image2" />
<label for="image2">image2</label></td>
<td width="102"><input type="radio" name="radio" id="image3" value="image3" />
<label for="image3">image3</label></td>
</tr>
</table>
</form>
</body>
</html>
-
- Similar Topics
- Replies
- Views
- Last post
-
-
ถาม jQuery jQuery.get() กับ jQuery.post() ใน ajax
by jay_limm » 18/06/2014 2:15 pm » in JavaScript & Jquery Ajax - 2 Replies
- 3435 Views
-
Last post by jay_limm
18/06/2014 2:48 pm
-
-
-
สอบถามทำ jquery เปิด-ปิดช่องตามที่เลือกจาก radio
by eange08 » 03/02/2021 12:32 pm » in JavaScript & Jquery Ajax - 2 Replies
- 274 Views
-
Last post by eange08
03/02/2021 2:21 pm
-
-
- 0 Replies
- 675 Views
-
Last post by M009
01/07/2013 7:13 pm
-
-
วิธีการใช้งาน JQuery กับ Ajax เพื่อค้นหาข้อมูลจากฐานข้อมูลว่ามมีจริงหรือไม
by Ittichai_chupol » 27/11/2019 2:28 pm » in Jquery & Ajax Knowledge - 0 Replies
- 783 Views
-
Last post by Ittichai_chupol
27/11/2019 2:28 pm
-
-
-
อยากรู้ว่ามี วิธีเช็คการทำงานมั้ยค่ะ JavaScript , Jquery, Ajax
by thatsawan » 19/06/2014 12:07 am » in JavaScript & Jquery Ajax - 4 Replies
- 2902 Views
-
Last post by thatsawan
20/06/2014 1:07 pm
-
-
-
การค้นหาข้อมูล MySQL โดยใช้เทคนิค Modal JQuery Ajax
by abdkode » 05/04/2019 3:44 pm » in Jquery & Ajax Knowledge - 0 Replies
- 2766 Views
-
Last post by abdkode
05/04/2019 3:44 pm
-
-
-
Ajax Autocomplete Style MVC ใน Joomla โดยใช้ Jquery UI
by mindphp » 13/04/2012 3:23 am » in Share Knowledge - 0 Replies
- 3369 Views
-
Last post by mindphp
13/04/2012 3:23 am
-
-
-
ใช้ jQuery post ข้อมูลจากฟอร์ม ด้วย Ajax serialize
by mindphp » 21/02/2016 3:08 am » in Jquery & Ajax Knowledge - 1 Replies
- 794 Views
-
Last post by mindphp
21/02/2016 3:10 am
-
Who is online
Users browsing this forum: No registered users and 6 guests