Results 1 to 4 of 4

Thread: Javascript: Passing text

  1. #1

    Thread Starter
    New Member Skwirl's Avatar
    Join Date
    Jun 2004
    Posts
    10

    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.

  2. #2
    Don't Panic! Ecniv's Avatar
    Join Date
    Nov 2000
    Location
    Amsterdam...
    Posts
    5,343
    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

    BOFH Now, BOFH Past, Information on duplicates

    Feeling like a fly on the inside of a closed window (Thunk!)
    If I post a lot, it is because I am bored at work! ;D Or stuck...
    * Anything I post can be only my opinion. Advice etc is up to you to persue...

  3. #3

    Thread Starter
    New Member Skwirl's Avatar
    Join Date
    Jun 2004
    Posts
    10
    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.

  4. #4

    Thread Starter
    New Member Skwirl's Avatar
    Join Date
    Jun 2004
    Posts
    10

    Talking

    OK, i just changed your code around a little and it works. thank you so much!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width