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"></s cript> 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(func tion() {
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_a spx' does not contain a definition for 'lsAPDietOptions_SelectedI ndexChange d' and no extension method 'lsAPDietOptions_SelectedI ndexChange d' accepting a first argument of type 'ASP.admin_addnewpatient_a spx' could be found (are you missing a using directive or an assembly reference?) C:\Projects\AdaptSurvey\Ad min\AddNew Patient.as px 141
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.
$(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").
var found = false;
$('#lsAPExerciseOptions :selected').each(function(
if (parseInt($(selected).val(
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_a
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Put the jQuery ref in the master (only if all the content pages use it) and the actual javascript function code in the content.
ASKER
Thank you.
ASKER
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.