Sie sind nicht angemeldet.

1

Mittwoch, 22. Juni 2011, 12:27

Calling own defined javascript function with arguments on onclick from hotspot

Hi,

I have been trying to get a scene changing function to work that also changes some globals within my own javascript and sets the window location hash. However I have been unsuccesful getting it to work. The changeLocation(locId, locName) is defined in the main javascript that is included into the html containing the krpano viewer div. I tried the following:

// also tried all of these without spaces.. should not matter but I am kind of desperate ;P
onclick="js( changeLocation(1, 'foo') );"

onclick="js( changelocation(1, 'foo') );"

onclick="changeLocation(1, 'foo');"

onclick="changelocation(1, 'foo');"


Krpano does find the changeLocation function when not passing arguments, which results in a can't change to undefined scene, ofcourse.

I could swear I got it to work before, but maybe that was just a dream..

Kind regards,

Laurens

2

Mittwoch, 22. Juni 2011, 13:48

Hi,

try your call without single quote in argument
like onclick="js( changeLocation(1, foo) );"

--
Pratiks

3

Mittwoch, 22. Juni 2011, 13:51

I have found the solution! It does work with js() but I was using a string that contained a ' which prematurely ended the string in the js, which then probably generated a silent error within krpano.

Thanks for your suggestion Pratiks