Click to See Complete Forum and Search --> : Drop down menu


Dark Dragon
08-24-2003, 12:31 PM
I have a drop down menu on my page and the links work okay but the problem lies in when I am on one of the pages the link takes me to and I click on the link that takes me to the same page I am already on..it should just refresh but instead it says "Page Cannot Be Displayed" what should be done? Here is the code below.


<head>
<style>
body{font-family:arial;}

table{font-size:80%;background:black}

a{color:white;text-decoration:none;font:bold}

a:hover{color:#FF0066}

td.menu{background:teal}

table.menu
{
font-size:100%;
position:absolute;
visibility:hidden;
}
</style>
<script type="text/javascript">
function showmenu(elmnt)
{
document.all(elmnt).style.visibility="visible"
}

function hidemenu(elmnt)
{
document.all(elmnt).style.visibility="hidden"
}
</script></head>

<h3><img src="pics/wlcome.gif" width="359" height="31"></h3>

<table width="100%" align="center">
<tr bgcolor="#FF8080">
<td onmouseover="showmenu('Game Tips')" onmouseout="hidemenu('Game Tips')" bgcolor="#000033" width="33%">
<a href="/default.asp"><font face="Comic Sans MS">Game and Computer Tips</font></a><br />
<table class="menu" id="Game Tips" width="100%">
<tr>
<td class="menu"><a href="/spyro2.htm" target="_self">Spyro the Dragon:
Ripto's Rage</a></td>
</tr>
<tr><td class="menu"><a href="/xhtml/default.asp">Spyro the Dragon: Year of the Dragon</a></td></tr>
<tr><td class="menu"><a href="/css/default.asp">Spyro the Dragon: Enter the Dragonfly</a></td></tr>
<tr><td class="menu"><a href="/xml/default.asp">Jak and Daxter</a></td></tr>
<tr><td class="menu"><a href="/xsl/default.asp">Various Other Tips</a></td></tr>
</table>
</td>
<td onmouseover="showmenu('Artwork')" onmouseout="hidemenu('Artwork')" bgcolor="#000033" width="35%">
<a href="/default.asp"><font face="Comic Sans MS">My Artwork</font></a><br />
<table class="menu" id="Artwork" width="100%">
<tr><td class="menu"><a href="/js/default.asp">Pencil Drawings</a></td></tr>
<tr><td class="menu"><a href="/vbscript/default.asp">VPhotoshop Creations</a></td></tr>
<tr><td class="menu"><a href="default.asp">Digital Tablet Images</a></td></tr>
</table>
</td>
<td onmouseover="showmenu('Stuff')" onmouseout="hidemenu('Stuff')" bgcolor="#000033" width="32%">
<a href="/site/site_validate.asp"><font face="Comic Sans MS">"Stuff"</font></a><br />
<table class="menu" id="Stuff" width="100%">
<tr><td class="menu"><a href="/site/site_validate.asp">About This Site</a></td></tr>
<tr><td class="menu"><a href="/site/site_validate.asp">Brief Tutorials</a></td></tr>
<tr>
<td class="menu"><a href="/site/site_validate.asp">Tips and Whatever</a></td>
</tr>

</table>
</td>
</tr>
</table>

Fang
08-24-2003, 01:41 PM
Give each link the full URL: http://www.mysite.com/somedirectory/apage.html

David Harrison
08-24-2003, 01:41 PM
I'm making a site right now and I have a menu type structure on some pages. What I've done is where a link leads to the same page as the one it is on, I have done this:

<a href="#" onclick="return false;">Link</a>

xataku_nakusute
08-24-2003, 01:46 PM
hahahaha....lemme guess, this drop-down menu from w3schools, right? hehe, its all good, i used that one too til i figured out how to do it, lol.

anyway, what you should do is simply just change the href of the link when youre on that page, and make it something like "javascript:history,go(0)" and thattl refresh the page....
otherwise, pleaz post a link to your site or post your code on a thread so i know what youre talking bout, k?

hope it helps a bit

Dark Dragon
08-24-2003, 03:17 PM
hahahaha....lemme guess, this drop-down menu from w3schools, right? hehe, its all good, i used that one too til i figured out how to do it, lol.

Yeah..you are right.I got it from W3Schools.I used it as a template for a few reasons..one I was experimenting and I am not realy a hand coder but I wanted something different to utilize.

W3Schools is okay but I am finding that their codes are nearly worthless..Yes I know they have a disclaimer that they cannot gaurantee the code but is it really too much to ask that some viable and useful code is provided?

Anyways, thanks everyone..I will try out your suggestions!

Dark Dragon
08-24-2003, 03:24 PM
<a href="#" onclick="return false;">Link</a>

Umm..where do I put this particular code????

David Harrison
08-24-2003, 04:59 PM
If for example you were on the page default.asp, you would replace this:

<a href="/xhtml/default.asp">Spyro the Dragon: Year of the Dragon</a>

with this:

<a href="#" onclick="return false;">Spyro the Dragon: Year of the Dragon</a>


That way, when the link is clicked, for those with javascript nothing at all will happen and for those without it will appear as if nothing has happened but in the title bar you will notice a # at the end of the address.

Dark Dragon
08-25-2003, 12:13 PM
Oh!!..Okay, thanks a bunch LavaLamp!

P.S..Okay, I am back and I did what was suggested but it still gives me a "Page cannot be displayed" thing. Here is the changed line I now have

<td class="menu"><a href="#"onclick="return false;">Spyro the Dragon: Year of the Dragon</a></td></tr>

Do I have to get rid of something else?

David Harrison
08-25-2003, 01:06 PM
You should have a space between:

...href="#"

and:

onclick="return...


Like this:

...href="#" onclick="return...

Dark Dragon
08-25-2003, 01:11 PM
Okay..I did that but I still get the same problem...Hmmm...I am obviously doing something wrong here but I am unsure as to what....really odd :)

David Harrison
08-25-2003, 01:22 PM
Hmm... see if this script works for you, if it doesn't then there's something wrong with your browser and if it does then there's something wrong with your script.

Dark Dragon
08-25-2003, 01:34 PM
I think I just found my problem..one the actual page the link goes to I forgot to set that # thing as a link and I think I may have messed up the other links on that same page..I got a lot of fixing to do.

Thanks LavaLamp for all your patience and help :D

David Harrison
08-25-2003, 01:38 PM
I'm always happy to help. :) But if you have javascript enabled the:

onclick="return false;"

should stop the link from taking you anywhere.

Dark Dragon
08-26-2003, 04:14 PM
AARRGGHH!!!!:eek: :eek: :eek:

I thought I had the Script all ironed out and it still won't work...nuts..I have had it with this stoopid script..I'm gonna stick with something easier

screaming_banjo
08-28-2003, 05:48 AM
Hi

Just in case you want to try again, I too used that menu from W3C, this part in each page:

<script type="text/javascript">
function showmenu(elmnt)
{
document.all(elmnt).style.visibility="visible"
}

function hidemenu(elmnt)
{
document.all(elmnt).style.visibility="hidden"
}

</script>

<style type="text/css">

table{font-size:80%;background:black;}
table.menu{visibility:hidden;}
tr{font: bold;}

</style>

This part in a style sheet:

table.menu
{font-size:100%;
font:bold;
position:absolute;
background:black;}

td.menu
{background:#E7E3E3;
font:bold;}


Here's the actual menu:

<table width=100%></a>
<tr bgcolor="#BEC2C2">
<td onmouseover="showmenu('about')" onmouseout="hidemenu('about')">
ABOUT ME</br>
<table class="menu" id="about" width="100%">
<tr><td class="menu"><a class="menu" href="personal.htm">Personal Details</a></td></tr>
<tr><td class="menu"><a class="menu" href="refs.htm">References</a></td></tr>
<tr><td class="menu"><a class="menu" href="aims.htm">Aims/Ambitions</a></td></tr>
<tr><td class="menu"><a class="menu" href="home.htm">Home</a></td></tr>
</table>
<td onmouseover="showmenu('education')" onmouseout="hidemenu('education')">
EDUCATION</br>
<table class="menu" id="education" width="100%">
<tr><td class="menu"><a class="menu" href="education.htm">College/University</a></td></tr>
<tr><td class="menu"><a class="menu" href="qualif.htm">Qualifications</a></td></tr>
</table>
<td onmouseover="showmenu('experience')" onmouseout="hidemenu('experience')">
EXPERIENCE</br>
<table class="menu" id="experience" width="100%">
<tr class="menu" ><td class="menu"><a class="menu" href="hobbies.htm">Hobbies</a></td></tr>
<tr class="menu1" ><td class="menu"><a class="menu" href="work.htm">Work Experience</a></td></tr>
</table></table>

As you can see, it's from my CV! It might help you a little more than the code on W3C and if it makes you feel any better, it took me ages to get it to work - lots of hitting my head off the wall!

Dark Dragon
08-28-2003, 06:04 PM
Thanks Screaming Banjo...I hope you don't mind that I copied and pasted the code into Notepad so I have a template to study. :D