My advice is:
1. Write better questions that are more than one line and really explain what you are trying to do.
2. Don't mix Java and JavaScript code.
3. Don't use JavaScript to program JavaFX.
---
You put JavaScript code in a CSS file - that will never work, a CSS file is for the CSS language, not JavaScript.
---
You wrote an alert in your JavaScript Sample. Normally an alert triggers a browser to show an alert dialog, it won't do that for JavaScript using JavaFX as there is no browser context to show the alert. I don't know what the alert would do if you tried to use it for a JavaFX program (likely nothing or print to a console). Basically, if you do use JavaScript and JavaFX, then don't use alert.
---
If you really want to program your JavaFX application in JavaScript, you can use Nashorn:
https://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/javafx.html
Again, I don't recommend that.
---
If you want to include JavaFX in your FXML files, you can do that using the fx:script element:
https://docs.oracle.com/javase/8/javafx/api/javafx/fxml/doc-files/introduction_to_fxml.html#scripting
http://stackoverflow.com/questions/19545727/how-to-load-fxml-dynamically-from-webserver (sample code in answer)
Again, I don't really recommend that.