-
Javascript: Passing text
Hi, I have a really basic question, but I'm just learning Javascript. I want to be able to have 4 links that have text assigned to them. for example, when you click on 'home' another part of the page will display the name 'home'. I have 1 page called index, and I have an iframe that i load all of the content into. I want one part of the index page to display what page that you are on in the iframe. Here is my code if it helps. If this is confusing, then just tell me and I will try to explain better.
<a href="home.htm" target="contentframe" onMouseover="nameofpage('Home')">Home</a>
<td class="nameofpage" background="images/nameofpage.gif" align="center" valign="center" name="NOP">
<script type="text/javascript">
function nameofpage(message)
{
document.NOP.write(message)
}
</script>
</td>
Thanks guys.
-
Hi,
Code:
<div id='NOP'>First display</div>
<a href='./Home.htm' onMouseOut='window.document.all.NOP.innerHTML="Second Display"' onMouseOver='window.document.all.NOP.innerHTML="<b>Home</b>"'> Home </a>
Try that.. cut n paste into a blank html file and see in ie to test - not sure it it will work with nutscrape, but worth a go.
You can always make it call a function instead, which accounts for browsers specific code :)
Vince
-
I'm sorry! i put mouseover... i meant to put click. when you CLICK the link, i want it to display the name of the link in another cell.
-
OK, i just changed your code around a little and it works. thank you so much!