How do I change how executable files are handled by the file manager?

Go to Edit>Preferences>Behavior in Nautilus, and change this option:

Nautilus

What these options mean:

"Run executable text files when they are opened"
This option will execute (run) text files as if they are programs (or scripts), but note that if the files are not scripts or have errors, you won't see a thing.

Note: This option is very risky, because it could allow you to run dangerous scripts accidentally.

"View executable text files when they are opened"
This option will provide the most comfortable behaviour, if you just need to view your text files (HTML, CSS, txt, etc). When you need to run actual scripts, you can right click them and choose to run them from the context menu, or use a terminal.

"Ask each time"
This option provides a safe balance between the two other options, allowing you to choose each time you double click on a text file, and providing a prompt that should help to avoid running risky files accidentally.