Have you look at the
ClientScriptManager class? You can use the
RegisterClientScriptInclude method to add javascript to the page eg.
if(!Page.ClientScript.IsClientScriptIncludeRegistered("MyJavaScript"))
{
Page.ClientScript.RegisterClientScriptInclude("MyJavaScript", ResolveClientUrl("~/myscript.js"));
}