external javascript file - .style .innerhtml etc

Oct 7 2009 9:05 AM
Hi All, I'm new to asp.net development. I'm using vs 2008 with c#. I'm running the code below in an aspx page, and it works fine, I tried moving it to an external javascript file, but when i do I don't get the full set of methods for getelementById() like .style, .innerhtml etc where I do when I put the javascript directly in the aspx page. The external js file is included correctly from the aspx page, and some javascript is working, it just seems to be a limited set of available functions.

var contentDom = document.getElementById("main-content");
var sidebarDom = document.getElementById("sidenav-content");
var temp = contentDom.offsetHeight;
sidebarDom.style.height = temp + "px";

Any help here is greatly appreciated?

Many thanks, Steve.

Answers (3)