You are not logged in.

Dear visitor, welcome to krpano.com Forum. If this is your first visit here, please read the Help. It explains in detail how this page works. To use all features of this page, you should consider registering. Please use the registration form, to register here or read more information about the registration process. If you are already registered, please login here.

  • "nathanfjohnson" started this thread

Posts: 11

Location: Calgary Canada

Occupation: Student

  • Send private message

1

Wednesday, July 8th 2009, 7:48am

Functions with Javascript - Please help

I made a function so that the caller can call the function and send it to a givin xml file
I'm new to javascript but it looks like it will only let me call the function with numbers, not strings. Ca

The function
:
function goto(xml, toh, tov, fov)
{krpano().call( "loadpano("+xml+",null,MERGE,BLEND(1));lookat(" + toh +"," + tov + "," + fov + ")" );}

The Caller:
<a onclick="goto(home.xml,-95,0,80)">go home</a>

I would really like to figure it out, everything works great until I call the function with the xml file's name, it lets me call it with a number.
Is it something to do with the "+ +"? I'm not sure what those are but it seems to need them.

Thanks

2

Wednesday, July 8th 2009, 3:41pm

Hi,

I think you need to put the "home.xml" in quotes (single quotes or double quotes, depending on the outer ones), otherwise javascript will look for a "home" object with the attribute "xml"
e.g.

Quoted

<a onclick="goto('home.xml',-95,0,80)">go home</a>
best regards,
Klaus

  • "nathanfjohnson" started this thread

Posts: 11

Location: Calgary Canada

Occupation: Student

  • Send private message

3

Thursday, July 9th 2009, 6:47am

Thank you

Thanks, it works great