views:

171

answers:

3

Problem 1

Error: Microsoft JScript runtime error: '$.fn' is null or not an object

Error area:

    $.fn.apply=function(item,content,header){

        $(".featureBox"+item).css('z-index', "1000");
        $("img.featureBox" + item +"top").attr("src",basepath + "box-big-top.jpg");
        $("img.featureBox" + item +"imgcut").attr("src",basepath + "box-big-img"+item+".jpg");
        featureboxcont[item].attr("src",basepath + "box-big-cont.jpg");
        $("img.featureBox" + item +"foot").attr("src",basepath + "box-big-bot2.jpg");
        //$("#NoteModalDialog > #x-dlg-bd > #x-dlg-tab > #acc-ct")

        $("#box"+item+"headtext > .h2div > h2").text(header);
        $("#box"+item+"bottext").css({"top":"181px","width":"205px","font-size":"12px","color":"#ffffff","left":"10"});
        $("#box"+item+"foottext").css({"top":footheight+"px","width":"215px","left":"20"});
        $("#box"+item+"hidden").css({"display":"block"});
        $("#box"+item+"bottext").text(content);
        $("#box"+item+"headtext > .h2div > h2").removeClass("sIFR-replaced");
        callsIFR();
    }

Problem 2

Error : Microsoft JScript runtime error: 'null' is null or not an object

Error area :

$("#innerWrapper").addClass("js-version");

I'm also using protoype.js on page.

A: 

Why do you have apply in the declaration? apply is used to specify this with a method. typically you would do something like this...

var object1 = {X:"stuff"};

var $.fn = function () {
   /* substitute your method here */
   this.X = this.X || "default";
   alert(this.X);
};

$.fn.apply(object1);
Tim Hoolihan
my added code is not whole code it's part of code where javascript debugger is highlighting
metal-gear-solid
@Tim: It's an easy mistake, but I don't think his `apply` has anything to do with the usual `Function#apply`, it's just a convenient term for what he wants to do. jQuery's `$.fn` is not (confusingly!) a function, it's just a reference to the `jQuery.prototype` object.
T.J. Crowder
+2  A: 

It sounds like your problem is that both prototype and jQuery use the $ function/variable name. Check out this page on how to set jQuery to not conflict with prototype.

fudgey
+1  A: 

If you're using jQuery and Prototype on the page, $.fn will indeed likely be undefined at global scope. The only way to use jQuery and Prototype on the same page is to use jQuery.noConflict and give it a different symbol than $, which Prototype also uses.

T.J. Crowder
@TJ - first error has gone after implementing your second suggestion of this link http://stackoverflow.com/questions/2721815/how-to-be-a-jquery-no-conflict-expert/2721977#2721977 now second error still coming.
metal-gear-solid