Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Oct 2002
    Messaggi
    52

    aiuto per modifica script

    >Ciao a tutti, sto cercando di modificare questo script! Ovviamente invano. Ho aggiunto un pop up per il problema, ma non funziona, doov'è l'errore?

    Grazie lelle




    <HTML><HEAD>
    <TITLE>Untitled</TITLE>
    </HEAD>
    <BODY>
    <SCRIPT language=javascript>
    var iArrayMax = 10
    var aDropdown = new Array(iArrayMax)

    //as the page loads - first thing to do is to load the dropdown array
    var bOk = LoadArrays()

    function LoadArrays()
    {
    //this can be thought of as an object array, each element can be identified as a property of the array position
    // a very powerful structure for 'client side' data caching.
    Array[0] = new sElement('SO','Mac','Machintosh')
    Array[1] = new sElement('SO','lix','Linux')
    Array[2] = new sElement('SO','win','Windows')
    Array[3] = new sElement('SO','Alt','Altri')
    Array[4] = new sElement('MC','dw','Dreamwaver')
    Array[5] = new sElement('MC','fl','Flash')
    Array[6] = new sElement('MC','fh','Freehand')
    Array[7] = new sElement('MC','fw','Fireworks')
    Array[8] = new sElement('PB','p1','Problema harware')
    Array[9] = new sElement('PB','p2','Problema software')


    return true
    }

    function sElement(sParentId,sValue,sDescription)
    {
    // elements that will be loaded into the array structure and persisted
    // think of it as an object.
    this.ParentId = sParentId
    this.Id = sValue
    this.Description = sDescription
    }

    function bCascadeDrop(oDDsource,oDDdest)
    {
    //function to enable cascading dropdowns
    //called as the parent dropdown changes.
    var iX
    var sText
    var iY= 0
    var sOptionId
    var sOptionDesc
    var iStartPos

    //find the value of the item currently selected
    sText = oDDsource.options[oDDsource.selectedIndex].value
    if (sText != '0')
    {
    //clear down the destination list box
    oDDdest.options.length = 0

    //loop through the elements that are in the array
    // if they match the parent if then they should be displayed.
    for (iX=0; iX<=iArrayMax; iX++)
    {
    if(sText == Array[iX].ParentId)
    {
    //grab the values out of the element (Netscape is not happy doing too many things in a function

    call!)
    sOptionId = Array[iX].Id
    sOptionDesc= Array[iX].Description
    //alert(sOptionDesc)

    //write the element into the dripdown box.
    oDDdest.options[iY] = new Option (sOptionDesc,sOptionId)
    iY = iY +1
    }
    }
    }
    }
    </SCRIPT>

    <FORM action=FrmNew>
    <TABLE>
    <TBODY>
    <TR>
    <TD>Categoria</TD>
    <TD><SELECT style="WIDTH: 150px" onchange="bCascadeDrop(this, document.forms[0].sRegion)" name=sCountry>
    <OPTION value=0 selected>Categoria...</OPTION>
    <OPTION value=SO>Sistema operativo</OPTION>
    <OPTION value=MC>Macromedia</OPTION>
    <OPTION value=PB>Problema</OPTION></SELECT>
    Sottocategoria
    <SELECT style="WIDTH: 150px" name=sRegion size="1">
    <OPTION value=0 selected>&lt;---------------------</OPTION> </SELECT>
    problema
    <SELECT style="WIDTH: 150px" name=sRegion size="1">
    <OPTION value=0 selected>&lt;---------------------</OPTION> </SELECT>


    </TD>

    </TR>

    </TBODY></TABLE></FORM></BODY></HTML

  2. #2
    Utente di HTML.it
    Registrato dal
    Sep 2001
    Messaggi
    206
    scommetto che lo hai fatto con dreamweaver!!!
    il problema è che hai due tag select con lo stesso name "sRegion" e poi quando fai il ciclo for sugli Array togli la condizione di <= e metti quella di < altrimenti cerca anke l'Array[10] che non esiste!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.