Jquery เปลี่ยนรูปตามค่าที่เลือก มาจาก Listbox

ตอบกระทู้

รูปแสดงอารมณ์
:icon_plusone: :like: :plusone: :gfb: :-D :) :( :-o 8O :? 8) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :!: :?: :idea: :arrow: :| :mrgreen: :angry: :baa: :biggrin:
รูปแสดงอารมณ์อื่นๆ

BBCode เปิด
[img] เปิด
[url] เปิด
[Smile icon] เปิด

กระทู้แนะนำ
   

มุมมองที่ขยายได้ กระทู้แนะนำ: Jquery เปลี่ยนรูปตามค่าที่เลือก มาจาก Listbox

Re: Jquery เปลี่ยนรูปตามค่าที่เลือก มาจาก Listbox

โดย chornma » 08/04/2017 5:54 pm

โค้ด: เลือกทั้งหมด

<script type="ai/javascript">
   $(document).ready( function(){
      $('#vie').change( function (e) {
          $('#image').attr('min', $(this).vie() );
      })
   });
</script>

Jquery เปลี่ยนรูปตามค่าที่เลือก มาจาก Listbox

โดย mindphp » 30/03/2012 6:57 pm

Listbox

โค้ด: เลือกทั้งหมด

  <select name="sale" id="sale" >
    <option value="sale1.jpg">sale1.jpg</option>  
    <option value="sale2.jpg">sale2.jpg</option>  
  </select>
ภาพที่แสดง

โค้ด: เลือกทั้งหมด

<img id="staff_pic" src="sale0.jpg" border="0" height="150" width="150">
Javascript

โค้ด: เลือกทั้งหมด

<script type="text/javascript">
	$(document).ready( function(){
		$('#sale').change( function (v) {
			 $('#staff_pic').attr('src', $(this).val() );
		})
	});
</script>

ข้างบน