SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Farmington
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Hover Link on Image MouseOver

    Hi,
    I have a link and an image next to each other. I want to make the link hovered when I do mouseover on image. How do I do that ?

    Here is the code I have now.
    <a href="javascript:undefined" id="imageLinkId">GMNA</a>&nbsp;

    <script language="javascript">
    if( ... ) {
    document.write('<img src="/graphics/channel/plus.png" id="div18Img" alt="Maximize this section" onMouseOver= >'); }
    else {
    document.write('<img src="/graphics/channel/minus.png" id="div18Img" alt="Minimize this section" onMouseOver= >'); }
    </script>

    Thanks

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    <a href="javascript:undefined" id="imageLinkId">GMNA</a>&nbsp;
    So... What is that you want to achieve with this? You are just using the JavaScript protocol to say undefined.

    Also, don't use document.write, use the DOM to change existing HTML.

    You might wanna take some JavaScript tutorial or buying a JavaScript book to understand the basics before gong further.

  3. #3
    SitePoint Enthusiast
    Join Date
    Mar 2004
    Location
    Farmington
    Posts
    80
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have an onClick event in <a> tag which I eliminated intentionally to avoid confusion. That's why I had javascript:undefined. Anyhow, Thanks for your suggestion. I will look into DOM to change existing HTML.


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
  •