On Jul 9, 4:18 pm, yuqiao...@gmail.com wrote:
> Hi,
>
> I'm not very familiar with javascript, but I found a script that would
> really help with my site. The javascript tool is an image viewer. When
> a user clicks on an image, it displays content for the user. But I
> can't seem to get the browser to display the HTML code correctly even
> though the HTML code works when it's not within javascript code. It
> doesn't seem to recognize the valign = 'top' and the text-align =
> 'left' code.
valign is deprecated in HTML 4, text-align is not a valid HTML
attribute, see below.
> It displays the text in the center of the TD element.
> Does anyone have any idea how to force the browser to recognize the
> valiang and text-align?
>
> Thanks in Advance!
>
> Imagespace is a div
>
> imagespace.innerHTML = "<table style='width: 500px'>"+
> "<tr style='height:200px'>"+
> "<td style='width:280px'><img
>
> alt=''src='test.jpg' width='279'
>
> height='200' /> </td>"+
If this is supposed to be HTML, forget the faux XMTL markup. To an
HTML parser, it is just junk.
> " <td valign='top'
>
> text-align='left'><strong>Title:</strong> Test Test<br />"+
text-align is not a valid HTML attribute name, it is a CSS property
name. Anyway, align left is the default, so why bother?
<td style="text-align: left;" ... >
I have no idea why the text is being centered unless you have some CSS
elsewhere that is doing it.
--
Rob
|