บทความไม่มีชื่อ

วันที่โพสต์: Apr 05, 2013 4:40:39 AM

abc

bbb

<?xml version="1.0" encoding="UTF-8" ?> <Module> <ModulePrefs title="Preferences for __UP_myname__" height="400"/> <UserPref name="myname" display_name="Name" default_value="Rowan"/> <UserPref name="myphoto" display_name="Photo" default_value="http://doc.examples.googlepages.com/rowan-headshot.jpg"/> <UserPref name="mychoice" display_name="Show Photo?" datatype="bool" default_value="true"/> <UserPref name="mycolor" display_name="Color" default_value="Yellow" datatype="enum" > <EnumValue value="Red" /> <EnumValue value="Aqua" /> <EnumValue value="Lime" /> <EnumValue value="Yellow" /> <EnumValue value="Pink" /> <EnumValue value="Orange" /> <EnumValue value="White" /> </UserPref> <Content type="html"><![CDATA[ <div id="content_div"></div> <script type="text/javascript"> // Get userprefs var prefs = new gadgets.Prefs(); function displayGreeting () { // Get current time var today = new Date(); var time = today.getTime(); var html = ""; // Based on the time of day, display an appropriate greeting var hour = today.getHours(); var salutation = "Afternoon"; if (hour < 12) { salutation = "Morning"; } else if (hour > 17) { salutation = "Evening"; } // Set the background color according to the mycolor userpref var element = document.getElementById('content_div'); element.style.height=250; // Set the background color according to the mycolor userpref element.style.backgroundColor=prefs.getString("mycolor"); // Display a greeting based on the myname userpref html += "<br><FONT SIZE=6>Good " + salutation + ", " + prefs.getString("myname") + "!!!<br><br></FONT>"; // If the "Show Photo?" checkbox is checked, display photo. if (prefs.getBool("mychoice") == true) { html += '<img src="' + prefs.getString("myphoto") + '">'; } element.innerHTML = html; } // Pass the userprefs for this module instance to the function // (allows users to include multiple module instances on their page) gadgets.util.registerOnLoadHandler(displayGreeting); </script> ]]> </Content> </Module>