View Full Version : .asp dynamic menus
artsapimp
07-24-2000, 02:19 PM
I am trying to create a website where the menus are created dynamically depending on prior choices and could use some help. I have made it where you choose one item from a drop down box and the 2nd changes. But it's not exactly what I'm looking for. Does anyone else have any suggestions or ideas that might meke the navigation a little easier or at least nicer to look at?
Right now I have 2 drop down boxes. In the first one if you choose Florida the 2nd one will then have Orlando, Tampa, Daytona, etc. as options. If you choose Nevada the 2nd will have Las Vegas, Henderson, Reno, etc.. It does the job, but I'm looking for something more user friendly.
Any ideas?
------------------
If you think an education is expensive...try ignorance.
UncaDanno
07-24-2000, 05:16 PM
Art,
Check out http://www.aspin.com/
All kinds of pointers, tips, samples, and such to wallow in for hours on end!
Enjoy.
artsapimp
07-25-2000, 02:13 PM
Thank you. I checked it out but the only things I could find were made in VBScript which doesn't work on Netscape. I need it to be done it javascript I guess. I found one but I'm having some problems with it. I will post the code here hoping for some help, but I will understand if it's too much to ask.
This code does just what I need which is make 2 drop down boxes, the 2nd changes depending on what is chosen in the first. I need it to do exactly that, but with 3. The 3rd will change depending on what the 2nd does.
Anyway, thanks for any help.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
<HTML>
<HEAD><SCRIPT LANGUAGE="JavaScript">< !--
function reshow(object) {
State = object.options[object.selectedIndex].text;
if (msie) window.document.frames[0].location.href = 'what.htm';
else {
for (var i = document.Cities.CityBox.length;i > 0;i--)
document.Cities.CityBox.options[0] = null;
reloading = true;
showlinks();
document.Cities.CityBox.options[0].selected = true;
}
return false;
}
function load(object) {
window.location.href = object.options[object.selectedIndex].value;
return false;
}
function showlinks() {
if (State == 'State1') {
opt('cr/one.zip','City1');
opt('cr/two.zip','City2');
}
if (State == 'State2') {
opt('al/why.zip','City3');
opt('al/wobg.zip','City4');
}
if (State == 'State3') {
opt('dc/track1.zip','City5');
opt('dc/track2.zip','City6');
}
}
function opt(href,text) {
if (reloading) {
var optionName = new Option(text, href, false, false)
var length = document.Cities.CityBox.length;
document.Cities.CityBox.options[length] = optionName;
}
else
document.write('<OPTION VALUE="',href,'">',text,'<\/OPTION>');
}
//--></SCRIPT></HEAD>
<BODY><CENTER>
<FORM NAME="States">
<SELECT NAME="StateBox" onChange="return reshow(document.States.StateBox)">
<OPTION>State1
<OPTION>State2
<OPTION>State3
</SELECT>
</FORM>
<SCRIPT LANGUAGE="JavaScript">< !--
var reloading = false;
var State = document.States.StateBox.options[0].text;
if (navigator.appVersion.indexOf('MSIE 3') != -1)
var msie = true;
else
var msie = false;
if (msie) {
document.write('<IFRAME FRAMEBORDER=0 SCROLLING=NO SRC="what.htm"' +
'WIDTH="100%" HEIGHT="100">');
document.write('<\/IFRAME>');
}
else {
document.write('<FORM NAME="Cities">');
document.write('<SELECT NAME="CityBox" onChange="return load(document.Cities.CityBox)">');
showlinks();
document.write('<\/SELECT>');
document.write('<\/FORM>');
}
//--></SCRIPT>
</CENTER></BODY></HTML>
[/code]
------------------
If you think an education is expensive...try ignorance.
artsapimp
07-25-2000, 02:15 PM
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by artsapimp:
Thank you. I checked it out but the only things I could find were made in VBScript which doesn't work on Netscape. I need it to be done it javascript I guess. I found one but I'm having some problems with it. I will post the code here hoping for some help, but I will understand if it's too much to ask.
This code does just what I need which is make 2 drop down boxes, the 2nd changes depending on what is chosen in the first. I need it to do exactly that, but with 3. The 3rd will change depending on what the 2nd does.
Anyway, thanks for any help.
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
sorry, the code starting working when you click on the page. I'll have to link it with a text file.
[/code]
http://artsapimp.8m.com/test.txt
You may have to copy and paste the URL into the address bar instead of clicking on the link. Sorry.
<HR></BLOCKQUOTE>
------------------
If you think an education is expensive...try ignorance.
artsapimp
07-25-2000, 02:22 PM
<BLOCKQUOTE><font size="1" face="Verdana, Arial">quote:</font><HR>Originally posted by artsapimp:
<BLOCKQUOTE><font size="1" face="Verdana, Arial">code:</font><HR><pre>
sorry, the code starting working when you click on the page. I'll have to link it with a text file.
[/code] http://artsapimp.8m.com/test.htm
You may have to copy and paste the URL into the address bar instead of clicking on the link. Sorry.
<HR></BLOCKQUOTE>
[/B]<HR></BLOCKQUOTE>
------------------
If you think an education is expensive...try ignorance.
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.