How to pass an instruction via js() with commas?

  • I have a JS() inside an xml and its html contained in an iframe inside the parent html.

    This works in the parent html:

    Code
    <a onclick="loadscene('scene_87, null, MERGE, BLEND(1), set(plugin[map].visible, false);');">

    but this in the xml within the iframe only works , but only the first parameter , it works up to the first comma:

    Code
    <hotspot name="capilla"  style="hotspot_over"
    		onclick="js(parent.loadscene(scene_09, null, MERGE, BLEND(1)); setmask(mask_capilla, 0,560,297);)" >
    		<point ath=" 0.069376" atv="-0.089533" />

    loadscene(scene_09, the rest does not work! I assume its because of the comma?

    how do I pass all the required actions ?

    tried " or ' and it does not work


    the function in the html is:


    Code
    function loadscene(scene)
      	{ 
      		krpano().call("loadscene(" + scene + ");");
      	
     	}

    any clue on how to solve this?

  • HI,

    Sorry for popping out here, but it seems like a best place for my question.

    Lets say I have an variable which I need to pass to js. This variable contains an xml string (with encoded <, > and so on) and some of the attibutes has a text with commas.
    Unfortunatelly, the krpano handles this and send it as a separate variables to the js function.

    How can I avoid splitting string to separate variables?

    Here is n example:

    xml:

    Code
    set(functionCall, "myJsFunction('&gt;text=&quot;hello, world!&quot;&lt;')");
    js(functionCall);

    js:

    Code
    var myJsFunction = function(param) {
    alert(param);
    }

    expected: alert with '<text="hello, world!"> text
    actual: alert with '<text="hello' text

Jetzt mitmachen!

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