innerHTML <div> hyperlink problem

F

fmcgulliver

I'm using innerHTML to insert a hyperlink inside a div element with
onmouseover. however, the link doesn't work in safari or in firefox.
Is there something I'm doing wrong?

Thanks!

function changetext(text,textlet,id)
{
document.getElementById(textlet+id).innerHTML = text;
}

....

<td width=350 colspan=2 height=60 onmouseover="changetext(' <a href=
\'nytimes.com\'>nytimes</a>,'bulk',$todo2.leftid)" padding=0 colspan=2
spacing=0 border=3 id="${todo2.leftid}flash" align=left >
<div id=bulk$todo2.leftid>
<font style="font-size: ${todo2.leftsizefont}pt">$todo2.leftwhy
</font>
<img height="60" src=/static/$todo2.leftidjpg>
</div>
</td>

....
 
T

Thomas 'PointedEars' Lahn

I'm using innerHTML to insert a hyperlink inside a div element with
onmouseover. however, the link doesn't work in safari or in firefox.
Is there something I'm doing wrong?

You do client-side scripting, but you don't post client-side code.
And you use innerHTML. Among other things.
[...]
function changetext(text,textlet,id)
{
document.getElementById(textlet+id).innerHTML = text;
}

...

<td width=350 colspan=2 height=60 onmouseover="changetext(' <a href=
-------------------------------------------------------------^
Begin of string literal
\'nytimes.com\'>nytimes</a>,'bulk',$todo2.leftid)" padding=0 colspan=2
------------------------------^ ^ ^
End of string literal | '- End of script code,
Begin of another string literal ---' unterminated string literal!
spacing=0 border=3 id="${todo2.leftid}flash" align=left >

Not Valid, the HTML `td' element has no `padding', `spacing' or `border'
attributes. And the `colspan' attribute is set twice, to the same value.
<div id=bulk$todo2.leftid>
<font style="font-size: ${todo2.leftsizefont}pt">$todo2.leftwhy
</font>

CSS exists since more than 7 years now. Dump the deprecated `font' element
already. Use `span' here instead.
<img height="60" src=/static/$todo2.leftidjpg>

Not Valid. The `src' attribute must be quoted (because of `/' and `.') and
the `alt' attribute is missing.

http://validator.w3.org/


HTH

PointedEars
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top