How to get value from a js function

Guillermo Oramas R.

I'm using the KRPano plugin for street viewer. I've a <hotspot> that needs to show a tooltip with a value when I click on it. That value I need to take it from a JS function. So I added a <style> to my hotspot:

<style name="styletooltips"
    onclick="exhibit(); set(layer[text].html, get(js(getText()))); "           
/>

My js function:

function getText()
{
    return "Hello World!";
}

I tried it that way but I keep getting null. If I take out the getbefore the js it shows literally js(getText()).

P.D: the exhibit() is KRPano action that shows the layer with the tooltip.

Dylan Corriveau

I haven't used KRPano very much, nor do I have an enviroment to test atm, but I do believe the get isn't necessary. I believe you would just need to do:

<style name="styletooltips"
    onclick="exhibit(); set(layer[text].html, js(getText())); "           
/>

If you look in the KRPano documentation, it says the get will try to:

Resolve the 'variable' to its value.

In this case, there isn't a variable in use, just a method. You should be safe to just call js and use the return (since it is a string literal).

Edit: I just noticed the parameters list for get, and it makes complete sense for your instance.

variable (Any Variable):
When the variable doesn't exists, then get() will return null.

Edit 2: Another option would be to try setting a variable with the value, then passing that. Example:

<style name="styletooltips"
    onclick="exhibit(); var item = js(getText()); set(layer[text].html, item)); "           
/>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to get a dynamic JQuery Selector from js function parameter value?

From Dev

How to get a value from function?

From Dev

how to get a value from function

From Dev

How to get function arguments' text value in js?

From Dev

How to get full value from power function

From Dev

How to Get the value from function in JQuery

From Dev

How to get posted value from different function?

From Dev

How to return value from anonymous function in js

From Dev

JS - How to get value from object by key

From Dev

Get the value from the function

From Dev

How to get value from one function to another function?

From Dev

how to get the value from request.get in node js

From Dev

How to get root node error value from rpart printcp function?

From Dev

How to get value from a react function within a react component

From Dev

jQuery plugin how to get value from function within the plugin

From Dev

How to get desired value from autocomplete jquery function?

From Dev

How to get value from inner function when using Protractor

From Dev

How to get INOUT value from a function (stored procedure)? with GOLANG

From Dev

How can I get the value from this variable inside function?

From Dev

How to get a return value from async function to a variable in React Native?

From Dev

how to get data value from html in javascript function?

From Dev

How to get desired value from autocomplete jquery function?

From Dev

How to get a value from another file function? python

From Dev

how to get value from java script function to perl

From Dev

how to get the value of a function from a button click in javascript?

From Dev

How to get value from inner function when using Protractor

From Dev

How to get lowest value from a column without GROUP BY function

From Dev

How to get a value from function javascript and print it to the chart

From Dev

How to get a return value from the function loaded in CreateThread()?

Related Related

  1. 1

    How to get a dynamic JQuery Selector from js function parameter value?

  2. 2

    How to get a value from function?

  3. 3

    how to get a value from function

  4. 4

    How to get function arguments' text value in js?

  5. 5

    How to get full value from power function

  6. 6

    How to Get the value from function in JQuery

  7. 7

    How to get posted value from different function?

  8. 8

    How to return value from anonymous function in js

  9. 9

    JS - How to get value from object by key

  10. 10

    Get the value from the function

  11. 11

    How to get value from one function to another function?

  12. 12

    how to get the value from request.get in node js

  13. 13

    How to get root node error value from rpart printcp function?

  14. 14

    How to get value from a react function within a react component

  15. 15

    jQuery plugin how to get value from function within the plugin

  16. 16

    How to get desired value from autocomplete jquery function?

  17. 17

    How to get value from inner function when using Protractor

  18. 18

    How to get INOUT value from a function (stored procedure)? with GOLANG

  19. 19

    How can I get the value from this variable inside function?

  20. 20

    How to get a return value from async function to a variable in React Native?

  21. 21

    how to get data value from html in javascript function?

  22. 22

    How to get desired value from autocomplete jquery function?

  23. 23

    How to get a value from another file function? python

  24. 24

    how to get value from java script function to perl

  25. 25

    how to get the value of a function from a button click in javascript?

  26. 26

    How to get value from inner function when using Protractor

  27. 27

    How to get lowest value from a column without GROUP BY function

  28. 28

    How to get a value from function javascript and print it to the chart

  29. 29

    How to get a return value from the function loaded in CreateThread()?

HotTag

Archive