To reference Javascript files in web parts, I’ve seen people adding them as embedded resources to the web part assembly. Problem is, simple updates to the Javascript in those files requires redeployment of the DLL and an iisreset.
Another way of referencing JS files is doing the below in CreateChildControls method. This way you can make updates to JS file independent of the web part assembly.
Literal ltlJS = new Literal(); ltlJS.Text = "<script type="text/javascript" src="" + SPContext.Current.Web.Url + "/_layouts/inc/Test.Js"></script>"; this.Page.Header.Controls.Add(ltlJS);
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode, .ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode pre
{font-size:small;color:black;font-family:consolas, "Courier New", courier, monospace;background-color:#ffffff;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode pre
{margin:0em;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .rem
{color:#008000;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .kwrd
{color:#0000ff;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .str
{color:#006080;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .op
{color:#0000c0;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .preproc
{color:#cc6633;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .asp
{background-color:#ffff00;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .html
{color:#800000;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .attr
{color:#ff0000;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .alt
{background-color:#f4f4f4;width:100%;margin:0em;}
.ExternalClass94D02F4A83B6493D81A1EF4081139C6A .csharpcode .lnum
{color:#606060;}