XML & Javascript (dynamic hotspot urls)

  • Dear Klaus & Krpano Community,


    I have been working with krpano for over 1.5 years and what
    a pleasure it has been thus far. Klaus-
    it is an absolute joy to work with your code. Thank you to everyone who
    contributes in this forum, it is a great resource and a wonderful visual portal
    to the rest of this world.


    I am having difficulty using Javascript and Krpano together.
    I am a noob with JS- however it is one of my top priorities to learn. I would
    greatly appreciate any help in this issue. I apologize in advance if I ask any
    noobish questions.


    I have this hotspot:


    XML

    Code
    <hotspot
    name="spot0" onclick="closeallobjects();if(flying == 1.0,
    flyback(spot0), flyout(spot0) );" url="???" onloaded="???"
    distorted="true" ath="44.0311" atv="-5.2106"
    width="84" height="8" flying_width="728"
    flying_height="90" backup_width="84" backup_height="8"
    flying="0" backup_rx="20.4057"
    backup_ry="0.409675" backup_rz="-2.24183"
    rx="20.4057" ry="0.409675" rz="-2.24183"/>


    I am trying to get the image url to load dynamically via
    javascript.


    Here is the javascript:


    JS

    Code
    ");
    
    
    //]]>-->&lt;a&lt;br&gt;href='http://d1.openx.org/ck.php?n=a37bf9fc&amp;amp;cb=INSERT_RANDOM_NUMBER_HERE'&lt;br&gt;target='_blank'&gt;&lt;img&lt;br&gt;src='http://d1.openx.org/avw.php?zoneid=257943&amp;amp;cb=INSERT_RANDOM_NUMBER_HERE&amp;amp;n=a37bf9fc'&lt;br&gt;border='0' alt='' /&gt;&lt;/a&gt;


    I have tried many routes to no avail, does anyone have any
    insite?


    Thanks!

  • After you have krpano defined

    this is an invocation code from OpenX, I will repost the JS in a more visually appealing way as well as my other options to embed the image.


    Javascript Tag

    &lt;a href='http://d1.openx.org/ck.php?n=a0d57…DOM_NUMBER_HERE' target='_blank'&gt;&lt;img src='http://d1.openx.org/avw.php?zoneid…;amp;n=a0d57812' border='0' alt='' /&gt;&lt;/a&gt;


    iFrame Tag


    &lt;a href='http://d1.openx.org/ck.php?n=a36d3…DOM_NUMBER_HERE' target='_blank'&gt;&lt;img src='http://d1.openx.org/avw.php?zoneid…;amp;n=a36d37f7' border='0' alt='' /&gt;&lt;/a&gt;</iframe>


    Image Tag


    What do you think the easiest method to set the url would be?

    Thanks for a rapid response!

  • I'm sorry I have no grasp of understanding how what you pasted relates to your question.
    iframe tag/javascript tag etc.. I don't see anything related to an iframe or javascript, and a variables containing your image src

    Based on a stab in the dark, it would be
    <script type="text/javascript">
    function $_GET(q,s) {
    s = s ? s : window.location.search;
    var re = new RegExp('&'+q+'(?:=([^&]*))?(?=&|$)','i');
    return (s=s.replace(/^?/,'&').match(re)) ? (typeof s[1] == 'undefined' ? '' : decodeURIComponent(s[1])) : undefined;
    }
    </script>

    <script>
    <!--
    var viewer = createPanoViewer({swf:"krpano.swf", id:"krpanoSWFObject", target:"panoDIV"});
    viewer.addVariable("xml", "file.xml");
    viewer.embed();
    krpano.call("set(hotspot[spot0].url,"+ $_GET('var1')+")");

    //-->
    </script>

Participate now!

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