JS is supported in epub3 but not epub2. And even in epub3, only a relatively small subset is of real use. As for adding scripted in the opf file? You need to add a properties="scripted" in the appropriate places. See the example below:
Code:
<item href="Text/File_with_script.xhtml" id="File_with_script.xhtml" media-type="application/xhtml+xml" properties="scripted"/>