Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8512865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T04:23:53+00:00 2026-06-11T04:23:53+00:00

I am aware this topic has been raised severals, however i have a slight

  • 0

I am aware this topic has been raised severals, however i have a slight confusion with displaying an image on a MouseOver. I currently have a div container with a coloured background that displays when you hover it. click here – scroll down the image at the bottom

The issue i am having is that i have a hidden button which i only want to display when the user hovers over .product-shot-bg i have made an attempt with trying to activate this function but i’m unable to get it to work..here what i’ve done thus far…

<script>
function show(#viewProductBtn){
    document.getElementById(#viewProductBtn) = "visible";
}

function hide(#viewProductBtn){
    document.getElementById(#viewProductBtn) = "Hidden";
}
 </script>

 <style>
 .product-shot-bg{
    -webkit-transition: all 0.5s ease;
    -moz-transition: all 0.5s ease;
    -o-transition: all 0.5s ease;
    width: 208px;
    height: 453px;
}

.product-shot-bg:hover{
    background-color: #f3f3f3;
}

    #viewProductBtn{
    background: url(css/images/viewProductBtn.png) no-repeat;
    width: 197px;
    height: 40px;
    float: left;
    visibility: hidden;
}
     </style>

   <!-- Html -->

   <div class="product-shot-bg" onMouseOver="show('#viewProductBtn')"      onMouseOut="hide('#viewProductBtn')"> <a href="#" id="viewProductBtn "></a>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T04:23:54+00:00Added an answer on June 11, 2026 at 4:23 am

    There are a couple of problems with your code:

    • You are confusing document.getElementById with jQuery’s ID selectors. The former takes the id of the element, whilst the latter, uses the syntax #id. Thus, if you intend to use document.getElementById, you should pass it the id without the #;
    • JavaScript identifiers/names can’t start with # so you should remove them from your show and hide functions;
    • You want to modify the style.visibility property to either hidden or visible in your show/hide functions;
    • There’s an extra whitespace in the id "viewProductBtn ".

    Here’s a fixed version of it:

    <script type="text/javascript">
    function show(viewProductBtn){
        document.getElementById(viewProductBtn).style.visibility = "visible";
    }
    
    function hide(viewProductBtn) {
        document.getElementById(viewProductBtn).style.visibility = "hidden";
    }
    </script>
    
    <div class="product-shot-bg" onMouseOver="show('viewProductBtn')"      onMouseOut="hide('viewProductBtn')"><a href="#" id="viewProductBtn"></a>​
    

    And a DEMO.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am aware that this topic has been covered already in many places, but
I am aware that a thousand and one questions relating to this topic have
I'm aware that there are a LOT of posts on this topic, however no
Though this topic has been discussed many times in this forum and all other
First off, I'm aware this is a bad practice and I have answered many
I have been using java for long time but this question came to my
I'm aware that there is another similar question on this topic, but personally I
I have read dozens of posts regarding this topic, without finding a clear guideline
I am aware that there are probably other questions regarding this topic. I guess
I have searched throughout SO on this topic for iPhone and everything points to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.