Get selecteditemindex within javascript function.

  • Hi,
    I'm very new to Javascript, XML and KrPano, please be gentle!
    I have a set of comboboxes and am trying to get the selected item indexes to allow me to generate a code to assign a specific scene to load. Unfortunately my code to get the index is returning as undefined.
    Where am I going wrong?
    Thanks in advance,
    Alex.

    EDIT:
    OK, so I've realised that call has no return value, so was never going to work.
    I've changed call to get, and while I am no longer getting undefined for each of the values, they still come back as null.
    Clearly I'm calling selecteditemindex with incorrect syntax, I shall keep experimenting.

    <combobox name="cb1" design="default" align="lefttop" x="10" y="10">
    <item name="Set1Op1" caption="Choice1_1" onclick="ldScn();"/>
    <item name="Set1Op2" caption="Choice1_2" onclick="ldScn();"/>
    </combobox>

    <combobox name="cb2" design="default" align="lefttop" x="10" y="110">
    <item name="Set2Op1" caption="Choice2_1" onclick="ldScn();"/>
    <item name="Set2Op2" caption="Choice2_2" onclick="ldScn();"/>
    </combobox>

    <combobox name="cb3" design="default" align="lefttop" x="10" y="210">
    <item name="Set3Op1" caption="Choice3_1" onclick="ldScn();"/>
    <item name="Set3Op2" caption="Choice3_2" onclick="ldScn();"/>
    </combobox>


    <action name="ldScn" type="Javascript"><![CDATA[

    var cb1Val = krpano.get("plugin[cb1].selecteditemindex();");
    var cb2Val = krpano.get("plugin[cb2].selecteditemindex();");
    var cb3Val = krpano.get("plugin[cb3].selecteditemindex();");

    var scnCd = cb1Val+cb2Val+cb3Val;

    alert(scnCd);


    ]]></action>

    Einmal editiert, zuletzt von doc11235 (2. Mai 2019 um 14:45) aus folgendem Grund: Some progress made.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!