A
addy
I am writing a gallery page where I am trying to load images in two
columns
of a table. I am able to get 1 row via getElementById but the second
one
returns a null which fails my other function which is responsible to
display
images in the table
Would appreciate if you could help me out.
following is the code for HTML
<!-- HTML code--->
<table border="0" width="98%" height="65%" id="content">
<tr><td colspan="3"> </td></tr>
<tr>
<td width="10%" id="spacer"> </td>
<td width="30%" valign="top" id="galrow" >
<script type="text/javascript">
CreateResidentialGallery();
</script>
</td>
<td width="50%" id="display">
</td>
</tr>
</table>
<!--- End HTML code -->
// Javascript code
function CreateResidentialGallery()
{
var arFileNames = new Array();
var arThumbObjects = new Array();
var arFullObjects = new Array();
arFileNames =[ 'images/img000002.jpg',
'images/img000003.jpg',
'images/img000011.jpg',
'images/img000014.jpg',
'images/img000017.jpg',
'images/IMG_0253.JPG',
'images/IMG_0254.JPG',
'images/IMG_0256.JPG',
'images/IMG_0258.jpg',
'images/IMG_0259.jpg',
'images/IMG_0260.jpg',
'images/IMG_0264.jpg',
'images/IMG_3754.JPG'
] ;
for(var i=0; i<arFileNames.length; i++)
{
var oImg = document.createElement("img");
oImg.src=arFileNames;
oImg.height=100;
oImg.width=100;
oImg.border=5;
arThumbObjects = oImg;
}
for(var i=0; i< arFileNames.length; i++)
{
var oImg = document.createElement("img");
oImg.src = arFileNames;
oImg.height=200;
oImg.width =250;
arFullObjects= oImg;
}
var oThumbParent = document.getElementById("galrow");
var oFullParent = document.getElementById("display"); <=== returns
null
LoadGallery(arThumbObjects,oThumbParent,arFullObjects,oFullParent);
}
//End Code javascript
columns
of a table. I am able to get 1 row via getElementById but the second
one
returns a null which fails my other function which is responsible to
display
images in the table
Would appreciate if you could help me out.
following is the code for HTML
<!-- HTML code--->
<table border="0" width="98%" height="65%" id="content">
<tr><td colspan="3"> </td></tr>
<tr>
<td width="10%" id="spacer"> </td>
<td width="30%" valign="top" id="galrow" >
<script type="text/javascript">
CreateResidentialGallery();
</script>
</td>
<td width="50%" id="display">
</td>
</tr>
</table>
<!--- End HTML code -->
// Javascript code
function CreateResidentialGallery()
{
var arFileNames = new Array();
var arThumbObjects = new Array();
var arFullObjects = new Array();
arFileNames =[ 'images/img000002.jpg',
'images/img000003.jpg',
'images/img000011.jpg',
'images/img000014.jpg',
'images/img000017.jpg',
'images/IMG_0253.JPG',
'images/IMG_0254.JPG',
'images/IMG_0256.JPG',
'images/IMG_0258.jpg',
'images/IMG_0259.jpg',
'images/IMG_0260.jpg',
'images/IMG_0264.jpg',
'images/IMG_3754.JPG'
] ;
for(var i=0; i<arFileNames.length; i++)
{
var oImg = document.createElement("img");
oImg.src=arFileNames;
oImg.height=100;
oImg.width=100;
oImg.border=5;
arThumbObjects = oImg;
}
for(var i=0; i< arFileNames.length; i++)
{
var oImg = document.createElement("img");
oImg.src = arFileNames;
oImg.height=200;
oImg.width =250;
arFullObjects= oImg;
}
var oThumbParent = document.getElementById("galrow");
var oFullParent = document.getElementById("display"); <=== returns
null
LoadGallery(arThumbObjects,oThumbParent,arFullObjects,oFullParent);
}
//End Code javascript