A: 

You can use the .selectedIndex property to get which one's selected, like this:

if(document.getElementById("idname").selectedIndex === 0) { //option 1
  //perform the script
}

It's a 0-based index, so 0 is Option 1 in your example markup, you can test/play with it here.


I'm unclear from the question, but if you want this on the change event, it'd look like this:

document.getElementById("idname").onchange = function() {
  if(this.selectedIndex === 0) {
    //perform the script
  }
};

You cant test it here.

Nick Craver
Hello Nick Craver, thanks for trying to help me. Like Brock Adams said I couldn't set the event handler that way. But ... you directed me ;-)
Faili
+1  A: 

Update:

Ok, if I understand the revised question, the code now works as intended except when option 1 starts as selected. (PS, the id's of the given code should be edited to match up.)

If that's true, then just change this line:

$("#tabelle").hide();

.
To this:

if ($("#option-type")[0].selectedIndex == 0 )
    $("#tabelle").show();
else
    $("#tabelle").hide();

In Greasemonkey, you can't set event handlers that way due to sandbox protection. See Common Pitfalls in Greasemonkey.
Also, with jQuery, there are easier ways to select that element.

Something like: $("#idname option:first").select (YourEventHandler) should work.

Where:

function YourEventHandler (Event)  
{
    //YOUR CODE HERE
    //Note: Event is a variable passed automatically to all event handlers, you often just ignore it.
}

Handy jQuery reference.

Brock Adams
Hello Brock,I hope I'm not looking totally noobish to you :(So, I was able to create a function and an event-handler which work fine. I edited my first post so that you can see my way and maybe(?) answer another question.
Faili
Ok, I updated my answer.
Brock Adams
I don't know how I can make it up. Every bit helps me understanding it better.Thank you soooo much.
Faili
You're welcome. Glad to help.
Brock Adams