The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

how do I?

plz!
how do i get this thing i copied someplace to work?
My intention is to give a text some letters, that "open up" to a linked word by a rollover function. i got it running with this script, except that after the linked letter the text continues in a new line.
can u tell me how to get the "blabla and so on" in the same line as the "B"??
thanx in advance...here´s the script:
in the head goes:
____________________________________
<script language="JavaScript"><!--
function changeContent(what,text) {
if (document.all)
what.innerHTML = text;
else if (document.layers) {
what.document.open();
what.document.write(text);
what.document.close();
}
}
_____________________________________
and in the body i put:
_________________________
<a href="anyplace.html">
<div onMouseOver="changeContent(this,'Before')"
onMouseOut="changeContent(this,'B')">
<nobr>B</nobr>
</div>
</a>
<a>
labla and so on
__________________________
(having defined a before as some style sheet)

Hi sebizwo. Basically I made 2 changes.
1) I changed DIV to SPAN because a div is a block element. This was causing the line-break.
2) Instead of "if (document.all)" I used "if (typeof(what.innerHTML) == 'string')". This tests for the existence of the property before we use it.

Hi sebizwo,
I forgot to mention -- that code assumes the surfing browsers knows one or the other method -- somewhere on the page you need to check if javascript is enabled and/or if the browser version is 4+

Hi Mike,
sometimes, but not often, I get lucky and get to a post first