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

  • 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.

    Quote

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

    best regards,
    Klaus

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!