Widget Walkthrough
(Page 1 of 5 )
The first half of this tutorial introduced you to making a rudimentary but functional widget of the sort you can find on Yahoo's site since its purchase of Konfabulator. In this article, you'll add the finishing touches to increase its functionality.
Widget Walkthrough
The preferences that you created in the first part of this article won't actually do anything on their own; they'll need the following JavaScript in order to actually make the required changes:
<action trigger="onLoad">
<![CDATA[
function updatepreferences() {
datatextarea.font = preferences.textfontpref.value;
datatextarea.color = preferences.textcolorpref.value;
datatextarea.size = preferences.textsizepref.value;
datatextarea.style = preferences.textstylepref.value;
}
updatepreferences();
]]>
</action>
<action trigger ="onPreferencesChanged">
updatepreferences();
</action>
As you can see, each action (onLoad and onPreferencesChanged) is contained within its own <action> element. All each line of the updatepreferences() function is doing is setting the attributes of the textarea element, much as CSS would with HTML. I've included the opening CDATA tag as we'll need it for one of the next functions.
Next: Getting the headlines >>
More XML Articles
More By Dan Wellman