hallo,
bin was den netscape 6/7 angeht leider kein stück informiert... kann mir daher jemand erklären wie das folgende script unter NC zum laufen gebracht werden kann?
Es sollen drei dynamische combo-boxen entspechend der auswahl in der ersten bzw. zweiten box mit dem jewiligen inhalt versehen werden.
hier das script: var NS4 = (document.layers)?true:false; var IE4 = (document.all)?true:false;
function _struct(child,childcaption,parent){ this.child = child; this.childcaption = childcaption; this.parent = parent; } function _addobject(child,childcaption,parent){ var obj = new _struct(); obj.child = child; obj.childcaption = childcaption; obj.parent = parent; return(obj); } function insertEntry(child,childcaption,parent){ if(child.length > 0 ){ for(var i=0;i<this.length;i++) if(this.items[i].child == child) return; this.items[this.length++] = _addobject(child,childcaption,parent); } } function OptionCollection(){ this.length=0; this.items = new Object(); this.Add=insertEntry }
function clearSelect(oSelect){ var iCount=0; if(!oSelect) return; iCount = oSelect.options.length; for(var i=0;i<iCount;i++){ if(IE4) oSelect.options.remove(0); else if(NS4) oSelect.options[0]=null; } } function addOptions(oSelect,olist,parent){ var elOption; var idxSelect=0;
//check arguments. if((!olist) || (!oSelect))return; if(parent.length <= 0) return;
//now looop through all the list items only entering relevant options. clearSelect(oSelect);
//add a blank list elBlankOption = new Option(); elBlankOption.text = ""; if(NS4) oSelect.options[0] = elBlankOption else if(IE4) oSelect.options.add(elBlankOption,0)
elBlankOption.value = ""; for(var i=0;i<olist.length;i++){ //only the child entries of the parent if(olist.items[i].parent == parent){ elOption = new Option(); //now IE and NS have a different way to handle object creation. if(NS4){ elOption.value = olist.items[i].child elOption.text = olist.items[i].childcaption oSelect.options[idxSelect] = elOption }else if(IE4){ elOption.value = olist.items[i].child elOption.text = olist.items[i].childcaption oSelect.options.add(elOption,idxSelect) } idxSelect++; delete(elOption); } } }
function clearOptions(szSelect,szForm){ if(szSelect.length <= 0 || szForm.length <=0) alert("error:clearOption must pass arguments"); if(IE4) clearSelect(document.all.item(szSelect)); else if(NS4) clearSelect(eval('document.' + szForm + '.' + szSelect)); }
function listAllOptions(szSelect,szForm,olist){ var elOption; var idxSelect=0; var oSelect = new Object();
//check arguments. if(!olist)return;
if(IE4) oSelect = document.all.item(szSelect); else if(NS4) oSelect = eval('document.' + szForm + '.' + szSelect);
if(!oSelect)return;
//now looop through all the list items entering all clearSelect(oSelect); for(var i=0;i<olist.length;i++){ elOption = new Option(); //now IE and NS have a different way to handle object creation. if(NS4){ elOption.value = olist.items[i].child elOption.text = olist.items[i].childcaption oSelect.options[idxSelect] = elOption }else if(IE4){ elOption.value = olist.items[i].child elOption.text = olist.items[i].childcaption oSelect.options.add(elOption,idxSelect) } idxSelect++; delete(elOption); } }
function UpdateSelect(szSelect,szForm,szParent,olist){ if(IE4) addOptions(document.all.item(szSelect),olist,szParent); else if(NS4) addOptions(eval('document.' + szForm + '.' + szSelect),olist,szParent); }
hier die seite: <html> <head> <meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0"> <title>OptionEx Include</title> <!--include the library-->
<script language=Javascript src="optionex.js"></script> <script language=Javascript> //create ourlink list of different model Series var oModelSeries = new OptionCollection(); //add a few entries this can also be written via asp dynamically //DAIHATSU oModelSeries.Add("asc","ASCEND","DAIHATSU"); oModelSeries.Add("cha","CHARADE","DAIHATSU"); oModelSeries.Add("v116","DELTA V116","DAIHATSU"); oModelSeries.Add("v58r","DELTA V58R","DAIHATSU"); oModelSeries.Add("s89r","PICK-UP S89R", "DAIHATSU"); //NISSAN oModelSeries.Add("sen","SENTRA","NISSAN"); oModelSeries.Add("cef","CEFIRO","NISSAN"); oModelSeries.Add("ser","SERENA","NISSAN"); oModelSeries.Add("c22","VANETTE","NISSAN"); oModelSeries.Add("ter","TERRANO 4X4","NISSAN"); oModelSeries.Add("cab","CABSTAR","NISSAN"); //PERODUA oModelSeries.Add("kc","KANCIL","PERODUA"); oModelSeries.Add("km","KEMBARA","PERODUA"); oModelSeries.Add("kn","KENARI","PERODUA"); oModelSeries.Add("rs","RUSA","PERODUA"); //okay so we have all the series for the models. //lets add the colors of the series. //again this can be written dynamically //DAIHATSU var oSeriesColors = new OptionCollection(); oSeriesColors.Add("efi16m","1.6 EFI (M)","asc"); oSeriesColors.Add("efi16a","1.6 EFI (A)","asc"); oSeriesColors.Add("espri","ESPRI","cha"); oSeriesColors.Add("v116cp","HA-5000KG (CARRYING POULTRY)","v116"); oSeriesColors.Add("v116lbv","HA-5000KG LUTON & BOX VAN","v116"); oSeriesColors.Add("v116sws","HA-5000KG STD WOODEN & STEEL","v116"); oSeriesColors.Add("v116wst","HA-5000KG WOODEN & STEEL TIPPER","v116"); oSeriesColors.Add("v116lbv7","HU-7000KG LUTON & BOX VAN","v116"); oSeriesColors.Add("v116sws7","HU-7000KG STD WOODEN & STEEL","v116"); oSeriesColors.Add("v116wst7","HU-7000KG WOODEN & STEEL TIPPER","v116"); oSeriesColors.Add("v58rcp","HS-4500KG (CARRYING POULTRY)","v58r"); oSeriesColors.Add("v58rlbv","HS-4500KG LUTON & BOX VAN","v58r"); oSeriesColors.Add("v58rsws","HS-4500KG STD WOODEN & STEEL","v58r"); oSeriesColors.Add("v58rwst","HS-4500KG WOODEN & STEEL TIPPER","v58r"); oSeriesColors.Add("s89rsb","LPR STEEL BODY","s89r"); oSeriesColors.Add("s89rslv","LPR STEEL BODY - LUTON VAN","s89r"); oSeriesColors.Add("s89rwb","LPR WOODEN BODY","s89r"); //NISSAN oSeriesColors.Add("sen15a","1.5L (A)","sen"); oSeriesColors.Add("sen15m","1.5L (M)","sen"); oSeriesColors.Add("sen16a","1.6L (A)","sen"); oSeriesColors.Add("sen18a","1.8L (A)","sen"); oSeriesColors.Add("brougham","BROUGHAM 3.0L (A)","cef"); oSeriesColors.Add("excimo","EXCIMO 2.0L (A)","cef"); oSeriesColors.Add("ser20a","2.0L (A)","ser"); oSeriesColors.Add("ser20hs","2.0L H/STAR (A)","ser"); oSeriesColors.Add("c22wvc","C22 W/VAN - COMMERCIAL","c22"); oSeriesColors.Add("c22wvp","C22 W/VAN - PRIVATE","c22"); oSeriesColors.Add("c22wvpc","C22 W/VAN - PRIVATE (COMPANY)","c22"); oSeriesColors.Add("c22ewvp","ELITE W/VAN FLG - PRIVATE","c22"); oSeriesColors.Add("c22ewvc","ELITE W/VAN FL - PRIVATE","c22"); oSeriesColors.Add("c22pvc","PANEL VAN FL - COMMERCIAL","c22"); oSeriesColors.Add("c22spvc","SEMI PANEL VAN FL - COMMERCIAL","c22"); oSeriesColors.Add("c22cabc","CHASSIS CAB - COMMERCIAL","c22"); oSeriesColors.Add("ter4x4p","TERRANO 4x4 - PRIVATE","ter"); oSeriesColors.Add("cabpc","UPGRADED (PETROL) - COMMERCIAL","cab"); //PERODUA oSeriesColors.Add("bf6ex","EX EXTRA 660cc","kc"); oSeriesColors.Add("bf8ex","EX 850cc","kc"); oSeriesColors.Add("bf8ez","EZ 850cc","kc"); oSeriesColors.Add("k3exgxez","EX, GX & EZ","km"); oSeriesColors.Add("k3se","SPECIAL EDITION EZ","km"); oSeriesColors.Add("j1ex","EX","kn"); oSeriesColors.Add("j1gxez","GX & EZ","kn"); oSeriesColors.Add("j1se","SPECIAL EDITION EZ","kn"); oSeriesColors.Add("rs1316","1.3 & 1.6 STANDARD","rs"); oSeriesColors.Add("rsex","1.6 GX EXTRA","rs"); </script> </head> <body> <p align=center>
<h1>Quick Price List</h1> <h1> <table>
<tr> <td colspan=6><font face=arial size=2><b>Example : select the Brand -> Model -> Type to get your desired price list.</font></b></td>
</tr></tr> <tr><!--parent select--> <td align=right valign=top><font face=arial size=2><b>Brand : </b></font></td> <td align=left valign=top><select name=model id=model onchange="UpdateSelect('series','carform',this.options[this.selectedIndex].value,oModelSeries);"> <option value="" selected >[Select a Brand]</option> <option value="PERODUA">PERODUA</option> <option value="NISSAN">NISSAN</option>
<option value="DAIHATSU">DAIHATSU</option> </select></td> <td align=right bgcolor=lightgrey><font face=arial size=2><b>Model : </b></font><br> <a href="javascript:clearOptions('series','carform');"><font face=arial size=2><b>Clear All!</b></font></a> </td><!--blank dummy option, need for navigator to set the size of dropdown list--><!-- three options a list is fine--><!--IE dynamically resizes the width of the select navigator doesn't--><!--so just give the option blank space or caption to set the size--> <td align=left valign=top><select name=series id=series onchange="UpdateSelect('carcolors','carform',this.options[this.selectedIndex].value,oSeriesColors);"> <option selected >[Select a Model]</option>
<option></option> <option></option> <option></option> </select></td> <td align=right bgcolor=lightgrey><font face=arial size=2><b>Type : </b></font><br> <a href="javascript:clearOptions('carcolors','carform');"><font face=arial size=2><b>Clear All!</b></font></a> </td> <td align=left valign=top><select name=carcolors id=carcolors onChange =" quicklink(this.value)"> <option selected >[Select a Type]</option>
<option></option> <option></option> <option></option> </select></td></tr></table></h1>
</body> </html>
für hilfe / hinweise wäre ich euch sehr dankbar... gruss zoran