getting javascript value into hotspot attribute

  • hi
    I want to put a value of a javascript function to a hotspot attribute. And I'm not really into javascript...
    I've tried something like this:

    <hotspot .... ath="js(azi());" .../>

    and a function:
    function azi()
    {
    alert("50");
    }

    but that's not working...what am I doing wrong?

    Einmal editiert, zuletzt von Muxi (15. April 2015 um 16:49)

  • thanks, I already got that I can't call anything from within an attribute...and tried with onloaded.
    I played around with your hint, but I can't get the ath-value set by javascript.
    I tried and other similar things, but without success.

    Code
    function sun_az()
    {
    var krpano=document.getElementById ("krpanoSWFObject");
    krpano.call("set(hotspot[spot1].ath,150");
    
    
    }
  • You can place var krpano=document.getElementById ("krpanoSWFObject"); after your embed call in javascript. No need to redefine it.

    First learn to effectively troubleshoot.
    1. enable the javascript console in your browser.
    2. run : krpano.call("showlog(true);");
    3. If the log appears, then krpano is accepting javascript calls, if not, perhaps you created the wrong swf file with options, or var krpano=document.getElementById ("krpanoSWFObject"); matches the wrong ID.
    4. Try krpano.call("set(hotspot[spot1].ath,150"); if that works then go back to working on your functions.
    5. you can run the javascript straight from the console and your krpano commands wrapped in krpano.call("");

    good luck!

Jetzt mitmachen!

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