Not sure what exactly you are trying to achieve but here I leave you some examples on how to add javascript to the views.