Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gif image on left side of two columned table?

Status
Not open for further replies.

natureboy76

Programmer
Oct 2, 2010
8
US
How do I place a gif image (javascript) into left column of a two column table? I have to put three paragraphs on the other column...I've tried numerous code but can't get any to work...

<body>
<table table width ="75%">
<tr>
<td> <img src="x" height="300" width="425" alt="Changing advertising image" /></td>
<td>row 1, cell 2</td>
</tr>
 
Is your question how to put an image element in the table using JavaScript, or is it how to modify an existing image that you already have in place? Or perhaps even how to cycle through several image using one as a placeholder?

I ask as the markup you've shown above is at odds with what you've actually asked for.

Perhaps you can clarify your requirements.

Dan



Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
It's how to put an image in using javascript. I'm to have the gif image in the left column and some paragraphs in the next.
 
Assuming the image markup you've shown in the left-hand cell above is what you want, probably the easiest method is to give the cell an ID:

Code:
<body>
<table  table width ="75%">
<tr>
<td[!] id="imgCell"[/!]></td>
<td>row 1, cell 2</td>
</tr>

And then insert the <img> by setting .innerHTML on the cell:

Code:
var imgMarkup = '<img src="x" height="300" width="425" alt="Changing advertising image" />';
var theCell = document.getElementById('imgCell');
theCell.innerHTML = imgMarkup;

Hope this helps,

Dan


Coedit Limited - Delivering standards compliant, accessible web solutions

Dan's Page [blue]@[/blue] Code Couch:
Code Couch Snippets & Info:
The Out Atheism Campaign
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top