Antville Help
Dienstag, 23. August 2005

Trick: Topics as Dropdown Menu

Here is what you put into the main skin or wherever you want the menu to show up:

<form>
 <select onChange="showSelectedEntry(this);" >
  <option selected="selected">Rubriken</option>
  <script type="text/javascript">
   var a = new Array ("" <% topiclist itemprefix=",'" itemsuffix="'" %>);
   renderTopicsOptions(a);
  </script>
 </select>
</form>

Then you need to add these two functions to the JavaScript skin.
function showSelectedEntry(menu) {
   window.location.href = menu.options[menu.selectedIndex].value;
}

function renderTopicsOptions (a) { for (var i=1;i<a.length;i++) { var t = /".+</.exec(a[i]); document.writeln("<option value="+ t +"/option>"); } }


I hope everything is escaped properly. Kudos to Tobi.

Sie sind nicht angemeldet