2013-03-06 166 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