Changing text on current page when mouseover

E

elyob

Hi,

I'm just wondering how I change some css text when I mouseover a picture. At
the moment document.write just writes to a new page.

function displayname(name)
{
document.write(name);
}

<a href="#" onMouseOver="displayname('Autumn Brown')"
onMouseOut="hidename()"><img src="img/autumnbrown.jpg" width="70"
alt="Autumn Brown" border="0"></a>

Thanks
 
R

Randy Webb

elyob said the following on 6/6/2006 1:52 PM:
Hi,

I'm just wondering how I change some css text when I mouseover a picture. At
the moment document.write just writes to a new page.

function displayname(name)
{
document.write(name);
}

<a href="#" onMouseOver="displayname('Autumn Brown')"
onMouseOut="hidename()"><img src="img/autumnbrown.jpg" width="70"
alt="Autumn Brown" border="0"></a>

Try reading the group FAQ. Specifically the section on DynWrite. It is
titled "How do I modify the current page in a browser?"
 
E

elyob

Randy Webb said:
elyob said the following on 6/6/2006 1:52 PM:

Try reading the group FAQ. Specifically the section on DynWrite. It is
titled "How do I modify the current page in a browser?"

Thanks, sorry for being crap....

Just wondering, is it cleaner to use an iframe and update a small area than
refresh the whole page (as your faq suggests).

Thanks
 
R

Randy Webb

elyob said the following on 6/6/2006 7:44 PM:
Thanks, sorry for being crap....

Just wondering, is it cleaner to use an iframe and update a small area than
refresh the whole page (as your faq suggests).

The FAQ doesn't suggest refreshing the entire page. DynWrite modifies
the innerHTML of a container object. You can do that, quite easily,
without refreshing an entire page.

Whether you use an IFrame or the DynWrite method would depend on what
you are wanting to change. For what you want to do, use DynWrite and
change the innerHTML of a div tag.

A better alternative for just the code you posted is the title attribute
of the img tag.
 

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

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top