| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
On Jun 23, 2005, at 10:19 PM, David Richmond wrote:
Since you're abstracting the data out, why not just put it into a _javascript_ file as an array that you iterate through? Something along this train of thought should work nicely: You create a file for the values you're abstracting out (say, Values.js). In it is an array with the needed values: var Values = [ "Value 1", ... "Value n", ]; Then, in your _javascript_ file (say, Widget.js) you include a setup() function that loads the values: function setup() { ... var menu = document.getElementById("myMenu"); var c = Values.length; for ( var i = 0; i < c; i++ ) { menu.add(Values[i]); } ... } To tie it all together you include both _javascript_ files into your HTML and call setup() when your widget's body loads: <html> <head> ... <script type='text/_javascript_' src='' charset='utf-8'/> <script type='text/_javascript_' src='' charset='utf-8'/> ... </head> <body > ... <select id='myMenu' ></select> ... </body> </html> |
_______________________________________________ Do not post admin requests to the list. They will be ignored. Dashboard-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/dashboard-dev/email@hidden This email sent to email@hidden
| References: | |
| >Using XML in Widgets/Javascript (From: David Richmond <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.