javascriptstdoutigoogle

document.write in iGoogle?


I am looking for document.write() property in iGoogle gadgets, how can I do the thing below in iGoogle gadget? In other words, I want stdout var in a script.

Example with document.write()

<html> <body>

<script type="text/javascript"> var firstname; firstname="Hege"; document.write(firstname); document.write("<br />"); firstname="Tove"; document.write(firstname); </script>

<p>The script above declares a variable, assigns a value to it, displays the value, changes the value, and displays the value again.</p>

</body> </html>

Solution

  • Simply enclose the code in a Content tag [type=html] with a CDATA

    <?xml  version="1.0"  encoding="UTF-8"?>
    <Module>
    <ModulePrefs title="hello world example" />
    <Content type="html"><![CDATA[
    <html>
    <body>
    <script type="text/javascript">
    var firstname;
    firstname="Hege";
    document.write(firstname);
    document.write("<br />");
    firstname="Tove";
    document.write(firstname);
    </script>
    <p>The script above declares a variable,
    assigns a value to it, displays the value, changes the value,
    and displays the value again.</p>
    </body>
    </html>
     ]]></Content></Module>