|
|
Quellcode |
1 2 3 4 5 6 7 8 |
//javascript:
var myText = krpano().call("get(data[myData].content);");
document.getElementById("somediv").innerHTML = "<span><strong>" + myText + "</strong></span>";
<!-- XML: -->
<data name="myData">
<p>Hello<br />World</p>
</data>
|
OK, so the call may not return data.
Big deal, almost assuredly, krpano can run javascript too.
JS -> Run krpano function, do variable stuff, run JS function to update the DOM.
Easy peazy.
JS function to run krpano function -> Krpano function to run JS function->
Exactly, you can grab the data element with krpano and use it, and you should be able to call a js function in krpano with those contents or at least, I don't see why not?
|
|
Quellcode |
1 2 3 4 5 6 7 8 |
//javascript:
var myText = krpano().call("get(data[myData].content);");
document.getElementById("somediv").innerHTML = "<span><strong>" + myText + "</strong></span>";
<!-- XML: -->
<data name="myData">
<p>Hello<br />World</p>
</data>
|
Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »patrickcheatham« (1. April 2011, 02:36)
Hi Klaus:
Using code similar to the below, I can't seem to get information from a <data/> element passed to a Javascript function. Is this not possible currently?
![]()
Quellcode
1 2 3 4 5 6 7 8//javascript: var myText = krpano().call("get(data[myData].content);"); document.getElementById("somediv").innerHTML = "<span><strong>" + myText + "</strong></span>"; <!-- XML: --> <data name="myData"> <p>Hello<br />World</p> </data>
|
|
Quellcode |
1 2 3 4 5 6 7 |
//javascript:
var myText;
myText = krpano().get("data[someData].content");
<!-- XML: -->
<!-- call javascript function "someFunction(arg1, arg2, arg3, [arg...])"-->
js( someFunction(get(data[someData].content), BlahBlah, Another Line of Blah) ) ;
|
Hi Klaus:
Using code similar to the below, I can't seem to get information from a element passed to a Javascript function. Is this not possible currently?
![]()
Quellcode
1 2 3 4 5 6 7 8//javascript: var myText = krpano().call("get(data[myData].content);"); document.getElementById("somediv").innerHTML = "" + myText + ""; Hello World
Sigh.
OK, below is the working implementation (both ways, from Javascript to KRPano or the reverse):
![]()
Quellcode
1 2 3 4 5 6 7//javascript: var myText; myText = krpano().get("data[someData].content"); js( someFunction(get(data[someData].content), BlahBlah, Another Line of Blah) ) ;
Thanks for putting up with my whinery![]()
HTH,
Patrick
Good work!Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von »patrickcheatham« (1. April 2011, 18:03)