...

View Full Version : Problem with Span



FatherShark
08-17-2005, 08:46 AM
Hi guys, could one of you look at this code if you get a chance - it's not working for me:

*Essentially what I am trying to do is have a description of a thumbnail appear in a "span" when a user clicks on a thumbnail (as well as a full version of the photo appear in another part of the table, which currently works okay). For some reason or another, it's just not happening.

<html>
<head>

<link rel="stylesheet" href="style.css"/>

</head>

<body>

<h1>Photo Page</h1>

<h2>My Favorite Holiday</h2>

<table width="100%" border="0">
<tr>
<td><img src="images/thumbs/holiday1thumb.jpg" width="100" height="75" onClick="document.getElementById('picture').src='images/full/holiday1.jpg'; document.getElementById('info').innerText='My wife Katrina and I dining'"></td>
<td rowspan="4"><img id=picture src="images/fill.gif"></td>
</tr>
<tr>
<td><img src="images/thumbs/holiday2thumb.jpg" width="75" height="100" onClick="document.getElementById('picture').src='images/full/holiday2.jpg';"></td>
</tr>
<tr>
<td><img src="images/thumbs/holiday3thumb.jpg" width="100" height="75" onClick="document.getElementById('picture').src='images/full/holiday3.jpg';"></td>
</tr>
<tr>
<td><img src="images/thumbs/holiday4thumb.jpg" width="100" height="75" onClick="document.getElementById('picture').src='images/full/holiday4.jpg';"></td>
</tr>
</table>

<br /><br />

<p><span id=info></span></p>

</body>

</html>

nikkiH
08-17-2005, 03:27 PM
innerText?

I think you wanted innerHTML.

FatherShark
08-18-2005, 12:52 AM
I changed it, and it worked - thank you very much.

Is InnerHTML W3C compliant?

nikkiH
08-18-2005, 03:04 PM
NO.
But it's pretty well supported.
If you want it to specs, you have to use createElement, appendChild, and the like. More work. Might be more cross-browser, but all the major ones right now support innerHTML.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum