Link to home
Start Free TrialLog in
Avatar of Sudhanshum
Sudhanshum

asked on

Calling JS File function from Content Page

Hi Guys,I have master page and one content page.I was calling .js file from each content page and was using js function in content page .aspx file and It was working. But my requirement is that I will call that .js file from master page and use it's function from Content page .aspx file ,I tried this like adding script on Master page  and call function on content aspx page but its not working.Please help me asap.
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Can you post a link or source.
Avatar of Sudhanshum
Sudhanshum

ASKER

I have one collapseableDIV.js file that file has javascripts like that
function collapse(divName, calcHeight)
{

}


Then I have master page where I am adding that .js file reference like that
  <script type="text/JavaScript" src="../../../JavaScripts/collapseableDIV.js"></script>

Then I have one .aspx page which is using above master page and I am calling collapseableDIV.js function
in that .aspx file But its not calling.If I add that script   <script type="text/JavaScript" src="../../../JavaScripts/collapseableDIV.js"></script>  in .aspx file then it works fine.But if i try to add that script on Master page and removed that script from .aspx page then it does not work.
   Please guide.
Where in the master page did you put the script tag?
Below this tag
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
It would be very useful if we could see a link or some source code. Describing it tells us what you intended to do - not what actually was done. The quickest route to a solution is posting code / link we can look at to try and emulate the problem.

I am assuming you have checked your console window for errors?
I am attaching sample website.I have added reference in master page and accessing function on test.aspx page. Please set test.aspx as startup page.
TestWebsite.zip
ASKER CERTIFIED SOLUTION
Avatar of Julian Hansen
Julian Hansen
Flag of South Africa image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks I will get back to you.