Connecting drop down menus?

D

Don Schneider

Hi All,

Creating a drop-down menu is no problem for me, the problem I am having is
creating 2 or 3 beside each other, and clicking a choice in the 1st one and
it changes the coordinating choices in the other 2. I have seen it done on
other sites, but can the mighty MS Frontpage do it? Help!

Don
 
G

Guest

Not actually a FrontPage function, but javascript.

Visit http://www.irt.org for a wealth of information. For the answer to your
specific question, try http://www.irt.org/script/1046.htm, which gives this
example:

<html>
<head>
<script language="JavaScript"><!--
var whatForm, whatTo, whatText;

function reshow(number) {
whatFrom = document.forms['formName' + number].elements['selectName' +
number];
number++;
whatTo = document.forms['formName' + number].elements['selectName' +
number];

for (var i = whatTo.length;i > 0;i--)
whatTo.options[0] = null;

whatText = whatFrom.options[whatFrom.selectedIndex].text;

showLink(number);

whatTo.options[0].selected = true;

if (number == 2)
reshow(2);

return false;
}

function load(number) {
what = document.forms['formName' + number].elements['selectName' +
number];
window.location.href = what.options[what.selectedIndex].value;
return false;
}

function showLink(number) {
if (number == 2)
showLink2()
else if (number == 3)
showLink3();
}

function showLink2() {
if (whatText == 'Red') {
opt('red/ball.htm','Red Ball');
opt('red/hat.htm','Red Hat');
}

if (whatText == 'Green') {
opt('green/grass.htm','Green Grass');
opt('green/tree.htm','Green Tree');
}

if (whatText == 'Blue') {
opt('blue/sky.htm','Blue Sky');
opt('blue/car.htm','Blue Car');
}
}


function showLink3(text) {
if (whatText == 'Red Ball') {
opt('red/ball/round.htm','Round Red Ball');
opt('red/ball/flat.htm','Flat Red Ball');
}
if (whatText == 'Red Hat') {
opt('red/hat/top.htm','Red Top Hat');
opt('red/hat/flap.htm','Red Flap Cap');
}

if (whatText == 'Green Grass') {
opt('green/grass/tall.htm','Tall Green Grass');
opt('green/tree/cut.htm','Green Cut Grass');
}

if (whatText == 'Green Tree') {
opt('green/tree/oak.htm','Green Oak Tree');
opt('green/tree/elm.htm','Green Elm Tree');
}

if (whatText == 'Blue Sky') {
opt('blue/sky/cloudy.htm','Cloudy Blue Sky');
opt('blue/sky/clear.htm','Clear Blue Sky');
}

if (whatText == 'Blue Car') {
opt('blue/car/sports.htm','Blue Sports Car');
opt('blue/car/racing.htm','Blue Racing Car');
}
}

function opt(href,text) {
var optionName = new Option(text, href, false, false)
var length = whatTo.length;
whatTo.options[length] = optionName;
}
//--></script>
</head>

<body>
<center>

<form name="formName1" onSubmit="return load(1)">
<select name="selectName1" onChange="reshow(1)">
<option value="red.htm" selected>Red
<option value="green.htm">Green
<option value="blue.htm">Blue
</select>
<input type="submit" value="Go">
</form>

<form name="formName2" onSubmit="return load(2)">
<select name="selectName2" onChange="reshow(2)">
<option value="red/ball.htm" selected>Red Ball
<option value="red/hat.htm">Red Hat
</select>
<input type="submit" value="Go">
</form>

<form name="formName3" onSubmit="return load(3)">
<select name="selectName3">
<option value="red/ball/round.htm" selected>Round Red Ball
<option value="red/hat/flat.htm">Flat Red Hat
</select>
<input type="submit" value="Go">
</form>

</center>
</body>
</html>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top