Triple "Drop-Down-Menü Schript" - Problem beim kombinieren 3 Ausgangsschripte

Inspirator

Grünschnabel
Ich hätte da mal ein kleines Problem.

Geht um ein nettes Script, das 3 Eigenschaften haben soll.
Ich habe auch die entsprechenden Einzelscripte.
Irgendwie habe ich es aber nicht geschafft diese 3 zu vereinen.

Vielleicht kann mir jemand dabei helfen und kurz
reinschauen. Würde mich sehr freuen.

Habe die Scripte als Anhang in eine txt-Datei !

Script 1 soll die funktionale Basis sein.
Also 3 Drop-Down-Menüs die mit einander verbunden sind und
eine logische Auswahl unterschiedlicher Kategorien erlaubt.
Letztendlich soll nach der letzten Auswahl per Button
eine bestimmte Seite aufgerufen werden.

Script 2 ermöglicht das Aufrufen einer Seite in einen bestimmten
Frame. Ich will 2 Frames nutzen. Das Menü soll im Navigatiosnmenü
sein und im Hauptframe die entsprechende verlinkte Seite
aufrufen.

Script 3 zeigt für jede Auswahl ein Infotext an.
Das ist ne sehr schöne Sache und diese möchte ich nun
für die triple Drop-Down-Menü verwenden.

Alle Scripte in einem vereint wäre mein Ziel.

Vielen Dank.

LG
Stephan

P.S. : Mit dem Anhänger der Datei hat es nicht geklappt.
Dehalb folgen die Scripte im Text !

1.Script
********
Code:
<FORM name="isc">
<table border="0" cellspacing="0" cellpadding="0">
  <tr align="center"> 
    <td nowrap height="11"> &nbsp;

<select name="example" size="1"
onChange="redirect(this.options.selectedIndex)">
<option selected>---Select1-------------</option>
<option>Webmaster Sites</option>
<option>News Sites</option>
</select>

<select name="stage2" size="1"
onChange="redirect1(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select2--------------</option>
<option value=" " selected>---Select2--------------</option>
</select>

<select name="stage3" size="1"
onChange="redirect2(this.options.selectedIndex)">
<option value=" " selected> </option>
<option value=" " selected>---Select3----------------</option>
<option value=" " selected>---Select3----------------</option>
</select>

<script>
<!--

var groups=document.isc.example.options.length
var group=new Array(groups)
for (i=0; i<groups; i++)
group[i]=new Array()

group[0][0]=new Option("---Select2---"," ");

group[1][0]=new Option("Now Select This One"," ");
group[1][1]=new Option("JavaScript","47");
group[1][2]=new Option("DHTML","46");
group[1][3]=new Option("CGI","45");

group[2][0]=new Option("Now Select This One"," ");
group[2][1]=new Option("General News","115");
group[2][2]=new Option("Technology News","116"); 

var temp=document.isc.stage2


function redirect(x){
for (m=temp.options.length-1;m>0;m--)
temp.options[m]=null
for (i=0;i<group[x].length;i++){
temp.options[i]=new Option(group[x][i].text,group[x][i].value)
}
temp.options[0].selected=true
redirect1(0)
}

var secondGroups=document.isc.stage2.options.length
var secondGroup=new Array(groups)
for (i=0; i<groups; i++)  {
secondGroup[i]=new Array(group[i].length)
for (j=0; j<group[i].length; j++)  {
secondGroup[i][j]=new Array()  }}

secondGroup[0][0][0]=new Option("---Select 3---"," ");
secondGroup[1][0][0]=new Option("---Select 3---"," ");
secondGroup[1][1][0]=new Option("Now Select This One"," ");
secondGroup[1][1][1]=new Option("JavaScript
Kit","http://javascriptkit.com");
secondGroup[1][1][2]=new Option("JavaScript for the non
programmer","http://webteacher.com/javascript/");
secondGroup[1][1][3]=new
Option("Java-Scripts.net","http://java-scripts.net");

secondGroup[1][2][0]=new Option("Now Select This One"," ");
secondGroup[1][2][1]=new Option("Dynamic
Drive","http://www.dynamicdrive.com");
secondGroup[1][2][2]=new Option("Beginner\'s Guide to
DHTML","http://www.geocities.com/ResearchTriangle/Facility/4490/");
secondGroup[1][2][3]=new Option("Web Coder","http://webcoder.com/");

secondGroup[1][3][0]=new Option("Now Select This One"," ");
secondGroup[1][3][1]=new Option("CGI
Resources","http://www.cgi-resources.com");
secondGroup[1][3][2]=new Option("Ada\'s Intro to
CGI","http://adashimar.hypermart.net/");

secondGroup[2][0][0]=new Option("---Select 3---"," ");
secondGroup[2][1][0]=new Option("Now Select This One"," ");
secondGroup[2][1][1]=new Option("CNN","http://www.cnn.com");
secondGroup[2][1][2]=new Option("MSNBC","http://www.msnbc.com");
secondGroup[2][1][3]=new Option("ABC News","http://www.abcnews.com");

secondGroup[2][2][0]=new Option("Now Select A Page"," ");
secondGroup[2][2][1]=new Option("News.com","http://www.news.com");
secondGroup[2][2][2]=new Option("Wired","http://www.wired.com");

var temp1=document.isc.stage3
function redirect1(y){
for (m=temp1.options.length-1;m>0;m--)
temp1.options[m]=null
for
(i=0;i<secondGroup[document.isc.example.options.selectedIndex][y].length;i++){
temp1.options[i]=new
Option(secondGroup[document.isc.example.options.selectedIndex][y][i].text,secondGroup[document.isc.example.options.selectedIndex][y][i].value)
}
temp1.options[0].selected=true
}

function redirect2(z){
window.location=temp1[z].value
}

//-->
</script>

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

2. Script
*********
Code:
<form name="framecombo">
<select name="framecombo2" size=1>
    <option value="http://dynamicdrive.com">Dynamic Drive</option>
    <option value="http://webreference.com">Webreference</option>
    <option value="http://javaboutique.com">Java Boutique</option>
    <option
value="http://javascriptkit.com/script/script2/comboframe.htm">Back to script</option>
  </select>&nbsp;<input type="button" value="Go!" onClick="jumpbox()"></p>
</form>

<script language="javascript">
<!--

/*Combo box with "open in another frame" credit
-By JavaScript Kit (www.javascriptkit.com)
Over 200+ free scripts here!
*/

//set below variable to "1" to open combo in another frame, "2" to open in
full window (parent window)
var openmode=1
//if above set to 1, specify the name of the frame you wish the combo to
load in below
var targetframe="bottomframe"

function jumpbox(){
var destination=eval("window.parent."+targetframe)
var thebox=document.framecombo
if (openmode==2)
destination=window.parent
destination.location=
thebox.framecombo2.options[thebox.framecombo2.selectedIndex].value
}    
//-->
</script>


3. Script
*********

Code:
<script language="JavaScript">
<!--

//Double Combo Box with Description Code- by Randall Wald
(http://www.rwald.com)
//Visit JavaScript Kit (http://javascriptkit.com) for script
//Credit must stay intact for use

var num_of_cats = 4; // This is the number of categories, including the
first, blank, category.
var open_in_newwindow=1; //Set 1 to open links in new window, 0 for no.
var option_array = new Array(num_of_cats);

option_array[0] = new Array("You need to select a category"); // This is the
first (blank) category. Don't mess with it.

option_array[1] = new Array("-- Select One --",
"JavaScript Kit",
"News.com",
"Wired");

option_array[2] = new Array("-- Select One --",
"CNN",
"ABC News");

option_array[3] = new Array("-- Select One --",
"Google",
"Ask Jeeves");

var text_array = new Array(num_of_cats);

text_array[0] = new Array("Here's how you use this box: First, you select a
category in the Category drop-down. Then, select a link from the Link
drop-down. Then, read the description in this box, or click Go to go to the page. If
you ever need to see this help again, just go back to the top option in the
Category box."); // These are general instructions. Change them if you want,
or keep them if you don't.

text_array[1] = new Array("These are some of my favorite technology sites.
You should visit them.", // Note that the first entry here is a general
description of this category. After than, they're descriptions of each link. Make
sure that you don't put the first link first; the general description must be
first.
"This is a page with a bunch of nice JavaScripts that you can use. They also
have tutorials in all sorts of subjects.",
"CNet news. If it's in technology, it's in here.",
"Wired magazine is the type of magazine which needs no introduction.");

text_array[2] = new Array("These days, it's important to keep up on the
news. These sites will help you do that.",
"CNN. What list of news sites would be complete without it?",
"Here, you can get links to World News Tonight, or see video clips.");

text_array[3] = new Array("If you can't find it via other means, you'll need
to find it with a search engine. These are some of the best.",
"Undoubtedly, the best search engine out there.",
"Their natural-language search sometimes comes up with results you won't get
with other engines.");

var url_array = new Array(num_of_cats);

url_array[0] = new Array("#"); // The first category. This should have no
items other than "#".

url_array[1] = new Array("#", // The second category; the first "real"
category. Note the initial #. That is the category which says "Please select a
link." It doesn't need a URL. Start putting the other URL's in after that first
line.
"http://javascriptkit.com/",
"http://www.news.com/",
"http://www.wired.com/");

url_array[2] = new Array("#",
"http://www.cnn.com/",
"http://abcnews.go.com/");

url_array[3] = new Array("#",
"http://www.google.com/",
"http://www.aj.com/");

function switch_select()

{
  for (loop = window.document.form_1.select_2.options.length-1; loop > 0;
loop--)
  {
    window.document.form_1.select_2.options[loop] = null;
  }
  
  for (loop = 0; loop <
option_array[window.document.form_1.select_1.selectedIndex].length; loop++)
  {
    window.document.form_1.select_2.options[loop] = new
Option(option_array[window.document.form_1.select_1.selectedIndex][loop]);
  }
  
  window.document.form_1.select_2.selectedIndex = 0;
}
  
function switch_text()

{
  window.document.form_1.textarea_1.value =
text_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex];
}

function box()

{
  if (window.document.form_1.select_2.selectedIndex == 0)
  {
    alert("Where do you think you're going?");
  } else {
    if (open_in_newwindow==1)
   
window.open(url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex],"_blank");
    else
   
window.location=url_array[window.document.form_1.select_1.selectedIndex][window.document.form_1.select_2.selectedIndex]
  }
}

function set_orig()

{
  window.document.form_1.select_1.selectedIndex = 0;
  window.document.form_1.select_2.selectedIndex = 0;
}

window.onload=set_orig

// -->
</script>

<form name="form_1" onSubmit="return false;">
  <textarea WRAP="virtual" name="textarea_1" rows=6 cols=60>
  Here's how you use this box: First, you select a category in the Category
drop-down. Then, select a link from the Link drop-down. Then, read the
description in this box, or click Go to go to the page. If you ever need to see
this help again, just go back to the top option in the Category
box.</textarea><br> <!-- This should be the same as the general instructions in the above
code. -->
  <select name="select_1" onChange="switch_select(); switch_text();">
    <option>-- Auswahl --</option>
    <option>Technology Sites</option>
    <option>News Sites</option>
    <option>Search Engines</option>
  </select>
  <select name="select_2" onChange="switch_text();">
    <option>You need to select a category</option>
    <option> </option>
    <option> </option>
  </select>
  <input type="submit" onClick="box();" value="Go!">
</form>
 
Zuletzt bearbeitet:
Zurück