Results 1 to 2 of 2

Thread: wierd question

  1. #1
    Join Date
    Jul 2005
    Location
    Kuwait-I'm American
    Posts
    127
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default wierd question

    I was wondering, and after much try have failed. Can you make a mouseover affect so the word (for example):

    LEARN HTML

    (which would be a hyperlink)

    would be changed to:

    LEARN HTML NOW!

    ?

    Could you do that? It would basicallt be adding a bit of text. These are some of the ways I tried (all useless):

    Code:
    <script type="text/javascript">
    document.write('<a href="blah.html">Hyperlink</a>
    onMouseover
    document.write('<a href="blah.html">Hyperlink to blah</a>
    </script>
    that code prooved useless...

    Code:
    <script type="text/javascript">
    "extra"=to blah //variable
    document.write('<a href="blah.html">Hyperlink</a>')
    onMouseover
    document.write(extra) + ('<a href="blah.html">Hyperlink</a>')
    </script>
    as did that one...

    Any Ideas?
    //\\ //\\// || //\\//\\ //\\ ||_
    SOFTWARE

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    One thing, once the document is parsed (loaded), invoking document.write produces what amounts to a new document, wiping out the current one. So, you need a different method. For something like this, the innerHTML property will serve:
    Code:
    <a href="htmltutorial.htm" onmouseover="this.innerHTML='LEARN HTML NOW!'" onmouseout="this.innerHTML='Learn HTML'">Learn HTML</a>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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