PDA

View Full Version : Drop-Down Menu not working


stevenm21
03-21-2006, 05:23 PM
I have been working on a new site and recently added some drop down menu's which were working ok, until today.

My drop down menu's has all of a sudden stopped working.

http://www.myworld21.co.uk/newsite/Honours.html

<select name="menu1" onchange="MM_jumpMenu('parent',this,1)">
<option selected="selected">--- Select Decade ----</option>
<option value="1930.html">1930's</option>
<option value="1940.html">1940's</option>
<option value="1950.html">1950's</option>
<option value="1960.html">1960's</option>
<option value="1970.html">1970's</option>
<option value="1980.html">1980's</option>
<option value="1990.html">1990s</option>
<option value="2000.html">2000's</option>
</select>

can anyone identify what is wrong, and why it seems to have stopped working all of a sudden

domedia
03-21-2006, 07:28 PM
There's nothing wrong with your HTML, but HTML is not what is making the link work or not..
Where's your javascript? You're calling a function MM_jumpMenu where is nowhere to be found.

stevenm21
03-21-2006, 08:01 PM
i haven't changed anything so why is it no longer there? Doesnt DW put the java in itself? can someone advise me what the java script should be so I can get the menu's to work?

davidj
03-22-2006, 07:49 AM
you need a function which is missing?

try this

function jumpmenu(){
d = document.getElementById('menu1');
path = d.value;
document.location.href = path;
}

change your dropdown onchange event to...

onchange="jumpMenu()"

dthomsen8
03-22-2006, 10:03 AM
i haven't changed anything so why is it no longer there? Doesnt DW put the java in itself? can someone advise me what the java script should be so I can get the menu's to work?

Be careful, Java and JavaScript are entirely different things, easily confused.

stevenm21
03-22-2006, 10:06 AM
where should I put the code? do I need to put it into <javascript></javascript? tags?

davidj
03-22-2006, 10:12 AM
i hear the word java being substituted for javascript all the time

99% of the time its just us being lazy (4 key presses instead of 10)

davidj
03-22-2006, 10:16 AM
where should I put the code? do I need to put it into <javascript></javascript? tags?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<script language="javascript">

function jumpmenu(){
d = document.getElementById('menu1');
path = d.value;
document.location.href = path;
}

</script>

</head>

<body>
<select name="menu1" onchange="jumpMenu()">
<option selected="selected">--- Select Decade ----</option>
<option value="1930.html">1930's</option>
<option value="1940.html">1940's</option>
<option value="1950.html">1950's</option>
<option value="1960.html">1960's</option>
<option value="1970.html">1970's</option>
<option value="1980.html">1980's</option>
<option value="1990.html">1990s</option>
<option value="2000.html">2000's</option>
</select>
</body>
</html>

stevenm21
03-22-2006, 10:21 AM
my pages use a template, should I put the javascript into the template so each page has it in it, saving me having to add it individually to each page that has a drop down menu?

davidj
03-22-2006, 10:29 AM
just create a javascript page which is a blank page with a .js extention

In DW go...
New >basic Page > Javascript

drop your function in that page and save it

(i normaly create a directory called java and save it in there to keep it tidy and out of sight)

now in your HEAD tag just add ...(below) .. to every page that uses JS

<script language="javascript" type="text/javascript" src="java/java.js"></script>

i prefer doing it this way all the time

stevenm21
04-03-2006, 01:08 AM
drop your function in that page and save it

(i normaly create a directory called java and save it in there to keep it tidy and out of sight)

now in your HEAD tag just add ...(below) .. to every page that uses JS

<script language="javascript" type="text/javascript" src="java/java.js"></script>


can I ask what do you mean by dropping my function in this page?

chriskq
04-03-2006, 06:00 AM
what he means by 'dropping ur function in the page' is that you are just calling it/ pointing to it (as an external file)
why let your html code looks all messy and nasty with js code everywhere, when you can keep it in a seperate folder as a sep file.
make sense ?