Question:

How can I made HTML links invisible or hidden after being clicked?

by  |  earlier

0 LIKES UnLike

I am working on a simple HTML-based Jeopardy game for work. Basically, each of the categories (dollar amounts) is a link to a page with the clue. I am trying to figure out a way to make the dollar amount link disappear once it has been clicked. I tried making the clicked link color the same as the background, but this has not worked. I really don't know how to use Java, so that is not a good option for me. Also, as a bonus, is there a way to make a pop-up window pop up to full size? I want the category clue to pop up in full screen if possible. Thanks!

 Tags:

   Report

2 ANSWERS


  1. The simplest way is to utilize CSS pseudo classes.

    Here is the basic code. You may need to modify it to suit your needs.

    a:visited {

    display: none;

    }

    This effectively makes the link disappear. I've never actually utilized this since I never had this type of issue come up, but in theory this should work.  


  2. You learn something new every day!!  Mattz' solution certainly works.

    What I did notice though, was that if a link disappears, everything else moves to compensate.  I'd suggest using tables (which you might be already) to make everything stay where you want it.  You'll need to specify a width in the <td> tags and/or add some text of the same colour as the background (or non-breaking spaces) to keep the cell sizes from changing when the link disappears and the cell from merging into the table's border.  An alternative would be to use frames.

    I also noticed that the link disappears when the mouse is moved away from it.

    You mean Javascript though, not Java; they are two different languages. :-)  Certainly Javascript will control the size a window is when it opens but I am fairly sure there is no way of doing that with HTML.  A trick that might work though, is this:

    When you want each window of a program to be a particular size and location, you can make sure the window isn't maximised and then size and position it to what you want.

    NOW make sure you use File --> Exit (or File --> Close if Exit isn't available) and all new windows of that program will open to the size and location you just chose.  Don't use the X in the top right corner while you are resetting the window setout.

    If you do this resizing just before starting the game, you should get the desired effect.

    All the best and have fun with your quiz. :-)

Question Stats

Latest activity: earlier.
This question has 2 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.