Opening a webpage when a selection is made in a dropdown menu

First time poster.

My students are trying to get a different webpage to open when they make a selection in a dropdown menu. They have tried to use the onclick function, but that opens it when you open the menu, they have also tried using the “change” function. but that opens the same webpage when you make any selection.

I think they need to use an if function and open a webpage if the index of the item is a certain number, but we aren’t getting it to work.

Anyone able to help?

They’re on the right track with change. What I’ve done before is I’ve used a “Select Action…” option as the first one when doing stuff like post options on [WUT] World. When the dropdown changes, it’ll perform the selected action (such as Edit or Delete) and set the dropdown back to Select Action. Here’s an example:

onEvent("dropdown_id", "change", function () {
  switch (getProperty("dropdown_id", "index")) {
    case 1:
      open("first website");
      break;
    case 2:
      open("second website");
      break;
    // ...
  }
  setProperty("dropdown_id", "index", 0);
});

That worked great, thanks!!