Michael, I don't have an answer for you as to why. However I do have a coding practice that I can share with you. Whenever I write a global function/ variable for use in a gadget I always append __MODULE_ID__ to it. __MODULE_ID__ gets replaced by Google with a number, thus ensuring that you won't have any naming conflicts with anything that Google adds in to the html of the iframe.
On Dec 20, 8:36 pm, Michael Hu <[email protected]> wrote: > Hi, everyone, I am a google gadget newbie. > > I created a test gadget in iGoogle, and I defined a function named > "clear". When I add this function to <input> method onclick, it > doesn't work! When I changed function name from "clear" to "clean", > everything just works fine. > > I don't know why, could someone explain this? > > ps: I tested this in Firefox 3.0.5 using GGE > > Here is my test gadget code: > > <?xml version="1.0" encoding="UTF-8"?> > <Module> > <ModulePrefs title="Dynamic Height" height="100"> > <Require feature="dynamic-height"/> > </ModulePrefs> > <Content type="html"><![CDATA[ > <script type="text/javascript"> > function add(element){ > var html = document.getElementById("container").innerHTML; > var msg = element.msg.value; > html += msg + "<br />"; > setContent(html); > > gadgets.window.adjustHeight(); > > } > > function clear(){ > setContent(""); > > } > > function setContent(cont){ > document.getElementById("container").innerHTML = cont;} > > </script> > > <div> > <form> > Say:<input name="msg" type="text" /><input type="button" value="Add" > onclick="add(this.form)" /><br /> > <input type="button" value="Clear" onclick="clear()" /> > </form> > <div id="container"></div> > </div> > ]]></Content> > </Module> --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "iGoogle Developer Forum" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/Google-Gadgets-API?hl=en -~----------~----~----~----~------~----~------~--~---
