javascript : IE 6 ไม่ทำงาน

หลักการทำงาน คือ มีรูปใหญ่หนึ่งรูป  แล้วมีรูปเล็กหลาย ๆๆ รูป พอคลิ๊กที่รูปเล็กแล้วรูปใหญ่เปลี่ยนโดย
   document.images['large'].src="image/001.jpg";
ซึ่งใน browser ตัวอื่นทำงานได้ค่ะ  แต่ว่าถ้าเป็น IE6 รูปจะไม่ขึ้นค่ะ  ต้องคอยคลิ๊ก show picture ตลอดเลยค่ะ

 
 

17 พ.ค. 2553 6 1,973

ไม่ค่อยเข้าใจคำถาม ?? 
#1

<table border="0" cellspacing="0" cellpadding="0">
  <tr align="left" valign="top">
    <td align="center"><img src="images/001-Big.jpg"  name="large" width="488" height="346" id="large" /></td>
  </tr>
   <tr align="left" valign="top">
     <td>&nbsp;</td>
   </tr>
   <tr align="left" valign="top">
    <td>
 
  <table width="30" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/001.jpg" width="171" height="121" class="img_news" style="cursor:pointer;" onclick="document.images['large'].src= 'images/001-Big.jpg'" /></td>
        <td>&nbsp;</td>
        <td><img src="images/002.jpg" width="171" height="121" class="img_news" style="cursor:pointer;" onclick="document.images['large'].src= 'images/002-Big.jpg'" /></td>
        <td>&nbsp;</td>
        <td><img src="images/003.jpg" width="171" height="121" class="img_news" style="cursor:pointer;" onclick="document.images['large'].src= 'images/003-Big.jpg'" /></td>
        </tr>
    </table></td>
  </tr>
</table>

จากโค๊ดเวลาคลิ๊กที่รูปเล็กแล้วรุปใหญ่จะเปลี่ยนตามน่ะค่ะ  โดยใช้วิธี document.images['large'].src="path ของรูปใหญ่";
ซึ่งใน browser ตัวอื่นทำงานได้ค่ะ  แต่ว่าถ้าเป็น IE6 รูปจะไม่ขึ้นค่ะ  ต้องคอยคลิ๊ก show picture ตลอดเลยค่ะ  พอจะมีวิธีไหน
บ้างค่ะให้สามารถแสดงผลใน IE6

#2

เปลี่ยนจาก name เป็น id แทนครับ

<img id="img-large" alt="" /> 

<img src="xxx.jpg" onclick="document.getElementById('img-large').src='large-xxx.jpg'" alt="" />
#3

ลองแล้วค่ะ  ยังไม่ได้เลย  เป็นเพราะอะไรค่ะ

#4

ดูให้ดีว่ามีอะไรผิดหรือเปล่า ทดสอบแล้วทำงานได้แน่ๆ

<img id="img-large" alt="" />

<img src="http://www.goragod.com/smalllogo.gif" onclick="document.getElementById('img-large').src='http://www.goragod.com/smalllogo.gif'" alt="" />

#5

ได้แล้วค่ะ  ขอบคุณค่ะ
#6
ความคิดเห็น
ไฟล์อัปโหลด ชนิด jpg, jpeg ขนาดไฟล์ไม่เกิน 1024
^