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.
Loading
Roei BarPosted Oct 7, 2009, 12:10 PM
and its fixed completly in VS 2010 which has full support for JQUery and JS :-)
Steve BradwellPosted Oct 7, 2009, 11:21 AM
Roei BarPosted Oct 7, 2009, 11:11 AM
javascript doesnt care where it is written in, wether its on page or in external js.
iyou f you have a style issue that you need to accomplish and you think the js is the problem you can try to investigate the js by adding a debugger line in it.
you can also use firefox FireBug in order to review the code and debug it online
you can also just override the css and dom elements style in online.
in IE you can use IE developer toolbar to override Element style.