If you are [developing a web part as a sandboxed solution][1], you could [add a `<JSLink>` node][2] to your ListFormWebPart or XsltListViewWebPart definitions:


    <WebPart xmlns="http://schemas.microsoft.com/WebPart/v2">
        <Assembly>Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c</Assembly>                        
        <TypeName>Microsoft.SharePoint.WebPartPages.ListFormWebPart</TypeName>
        <PageType>PAGE_NEWFORM</PageType>

        <JSLink>{path to JS file}</JSLink>

    </WebPart>

  [1]: http://sharepoint.stackexchange.com/questions/53109/porting-web-parts-to-office365-sharepoint-2013
  [2]: http://social.msdn.microsoft.com/Forums/en-US/sharepointdevpreview/thread/8441b87f-44f2-4b35-b0b3-d7b6f19fce2c/