Link to home
Start Free TrialLog in
Avatar of lapucca
lapucca

asked on

where should I put my javascript code for my content page?

Hi,
I put my javascript code in the head section in Master file but when I compile my content page gets error looking for a javascript code.  My question is do I leave my script ref to jQuery library in the Master page head section and put Javascript code as needed in each content page's content section for Master Head section?  Thanks.  I'm using asp.net 3.5

so, something like this would stay in the Mater page head section? <script src="../jQuery/jquery-1.5.1.min.js" type="text/javascript"></script> and
            $(document).ready(function() {
                $('ul.sf-menu').superfish();
            });

And then something specific Javascript function would be in the Content page, content section for the Master Head area,
    <script type="text/javascript" language="javascript">
        $(document).ready(function() {
            $("#lsAPExerciseOptions").click(function() {

                var found = false;
                $('#lsAPExerciseOptions :selected').each(function(i, selected) {
                    if (parseInt($(selected).val()) == 11) {
                        found = true;
                    }
                });

                if (found) {


Well, I re0arrange my code but I'm still getting error in the Content page that it cannot find the Javascript function,
Error      3      'ASP.admin_addnewpatient_aspx' does not contain a definition for 'lsAPDietOptions_SelectedIndexChanged' and no extension method 'lsAPDietOptions_SelectedIndexChanged' accepting a first argument of type 'ASP.admin_addnewpatient_aspx' could be found (are you missing a using directive or an assembly reference?)      C:\Projects\AdaptSurvey\Admin\AddNewPatient.aspx      141      
 
ASKER CERTIFIED SOLUTION
Avatar of Miguel Oz
Miguel Oz
Flag of Australia 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
Avatar of lapucca
lapucca

ASKER

Hi, yeah you're right. It's in the code behind.  I made a mistake thinking it's javascript.
However, my question still remains.  I wonder how do I do Javascript ref and function in Master and Content pages.  Where do I put the jQuery ref and actual javascript furnction code?  In master or content page?  Thanks.
Put the jQuery ref  in the master (only if all the content pages use it) and the actual javascript function code in the content.
Avatar of lapucca

ASKER

Thank you.