Recent Widgets


Register for DashboardWidgets

Recent Forums Posts

Partners


iCompositions

MacDesktops.net

RSS Showcase
RSS Comments
RSS Forums

This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies. Posted in: Widget Development

How to save the preference of selected index

Author Message
bwolf99



Joined: 04 Dec 2009
Posts: 1

Posted: Sat Dec 05, 2009 - 6:03 am    Post subject: How to save the preference of selected index Reply with quote

Hi!
I have a problem with writing a code to save the preference of following situation:
Here I have a select form:

Code:
<label for="stream-quality" data-locale="streamQuality">Stream quality</label>
   <select id="jump" onchange="reveal(this);" name="jump" >
      <option value="dewplayer256">256 kbps</option>
      <option value="dewplayer128">128 kbps</option>
      <option value="dewplayer32">32 kbps</option>
   </select>


Here is javascript:

Code:
function reveal(menu) {
         
     for(i=0;i<menu.options.length;i++)
          if(menu.options.selectedIndex==i)
               document.getElementById(menu.options[i].value).style.display='';
          else
               document.getElementById(menu.options[i].value).style.display='none';
}


I need that the option selected will be saved for next time I restart my widget.
I wanted to do it with widget.setPreferenceForKey but I didnīt know how to implement it in to my code.
Thank you for helping me.
Brano
View user's profile Send private message Send e-mail Widgets
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.

 
Powered by phpBB © 2001, 2002 phpBB Group