2013-03-06 82 views
0
function display() 
{ 
    var menu_frame_filtered = top.menu_frame.filtered; 
//filtered array taken from menu frame 
    var displayed = menu_frame_filtered; 
// giving filtered array new name 
    var p = displayed.length; 
// window.open('Part_database/' + displayed[0] + '.jpg') 
//displayed array contains image names and checked whether they are opening 
// 
    document.write('<table border="0" cellspacing="0" cellpadding="0">') 
    document.write('<tr>') 
    for(i = 0; i < p; i++) 
    { 
    document.write('<td>' + displayed[i] + '</td>') 
//image names in first cell 
    } 
    document.write('</tr>') 
    document.write('<tr>') 
    for(i = 0; i < p; i++) 
    { 
    document.write('<td width="250" ><img src="Part_database/ '+ displayed[i] +' .JPG" alt=' + displayed[i] + ' width="200" height="200" /></td>') 
//images in second cell 
    } 
    document.write('</tr>') 
    document.write('</table>') 
} 

上面的代碼沒有在表格中顯示圖像...試圖找出挑戰。 browser-IE8。 在此先感謝。圖像不能在html中顯示

+0

圖像的大小都大於2000x2000更大。我希望那些適合200x200大小的單元格。 – harsha 2013-03-06 08:58:44

回答

2

您有一個額外的空間,它可能不屬於:

document.write('<td width="250" ><img src="Part_database/ '+ displayed[i] +' .JPG" alt=' + displayed[i] + ' width="200" height="200" /></td>') 
                 ^    ^
                 ^    ^
                 ^    ^
+0

自1周以來我一直在嘗試。反正我不介意,因爲它是我的第一個代碼..非常感謝朋友 – harsha 2013-03-06 12:43:27