Help, for "HTML5 Javascript Plugins"

  • Hi All,

    I am learning to write my own plugin, but I have a problem.

    The pluginexample

    *question* How to use "onover" change " text.innerHTML "

    In text.xml

    Code
    <plugin name="test"
    	        url.html5="pluginexample.js"
    	        align="center" y="-150"
                    htmltext="TEXT"   <!-- My code -->
    	        mode="testing"
    	        value="200.0"
                    onover="set(htmltext, 'Hello');"    <!-- My code -->
    	        onclick="dosomething('hello', 'plugin');"
    	        />

    In pluginexample.js:

    Code
    text.style.color = plugin.textcolor;
      text.innerHTML = plugin.htmltext;   <!-- My code -->

    Thanks for any help

    Greetings
    Dashan

  • Hi,

    your code misses a lot of things...

    Here an example -when your plugin should have 'htmltext' and 'color' attributes:

    First define globally (inside krpanoplugin) the attributes with their default values:

    Code
    var xml_color = 0xffffff;
    var xml_htmltext = "";

    Then inside the registerplugin function register the attributes:

    Code
    plugin.registerattribute("color",    xml_color,    xml_color_set,    xml_color_get);
    plugin.registerattribute("htmltext", xml_htmltext, xml_htmltext_set, xml_htmltext_get);

    but do that after you had created your 'text' element, because the setter functions will be called here on registering.

    Then define again a global level the setter/getter functions from above:

    Best regards,
    Klaus

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!