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 7940445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T23:23:25+00:00 2026-06-03T23:23:25+00:00

I am writing a php page where when the mouse hovers over a link,

  • 0

I am writing a php page where when the mouse hovers over a link, more links and some info should drop down. Thing is, I have no idea how to do this.

I’ve put in some javascript, and I can get the id of the div that I want to drop down. Setting the visibility, however, doesn’t work as that just makes that block appear or disappear. Do I need to add and remove blocks? I would prefer if the solution does not need to reload the page, and css is, at best, a last resort.

<script type="text/javascript">
function showElement(id){
    document.getElementById(id).style.visibility = "visible";
}
function hideElement(id){
document.getElementById(id).style.visibility = "hidden";
}
</script>

For those of you that suggested I use jquery, here is my attempt, based on what you gave me and some googling:

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script type="text/javascript">
    $(document).ready( function() {
        $('a#').each( function(){
            var $id = $(this).attr('id');
            $('a#'+$id).hover(function(){
                $('div#'+$id).toggle();
            });
        });
    });
    </script>

It doesn’t work. Admittedly, that’s not surprising, seeing as I never looked at jquery before yesterday. Still, I have no idea what is wrong with it (probably quite a few things). What it is trying to do is iterate through all the links, then when hovered over, the div with the same name should display. Or that’s the theory.

  • 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-03T23:23:27+00:00Added an answer on June 3, 2026 at 11:23 pm

    Please consider using a javascript library like jquery to manipulate dom elements. Below is a very basic example of hover function.

    http://jsfiddle.net/LC7Fy/1/

    Check out jquery documentation for other usage examples.

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

Sidebar

Related Questions

I am writing a web page that uses some php files. The php isn't
I'm writing a PHP application that manages some LDAP entries. I have one page
Hi I'm having some problem with a PHP page: I'm writing a little CMS
I'm writing a php program that redirects user to a page.(something like link shortener)
Often when writing PHP I'll have it output some HTML like this - echo
I was writing a simple PHP page and a few foreach loops were used.
I'm writing a shell script to be executed by php page. The page has
I am writing a PHP page to convert an uploaded file to XML. I
I'm writing a quick PHP page, and I need to ignore any Strings with
I am writing PHP code for a dynamic web page. The SQL query code

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.