ASP.Net not working with JQuery in separate JS file or in HTML

Discussion in 'ASP .Net' started by JB, Sep 21, 2010.

  1. JB

    JB Guest

    Hello Community

    Using ASP.Net with a separate CSS file and separate Javascript file my
    applications work fine.

    Since JQuery offers features for web development I am substituting JQuery
    where ever possible.

    So I downloaded the JQuery library and added put it in the folder where my
    old Javascript code was and added it beneath my Javascript file resides in
    my html code:

    <link href="CssFolder/CssScr.css" rel="stylesheet" type="text/css"/>
    <script language="javascript" src="JsFolder/JsScr.js"
    type="text/javascript"></script>
    <script language="javascript" src=" JsFolder/jquery-1.4.2.min.js"
    type="text/javascript"></script>
    <script language="javascript" src=" JsFolder/jquery-1.4.js"

    Next I added the following code to my JsScr.js file:

    $(document).ready(function(){
    $("LinkButton").click(function(){
    $("p").hide();
    });
    });

    But I got an error stating:

    microsoft JScript runtime error: object expected

    and the code is highlighted.


    Because I got that error message I moved the JQuery code the JsScr.js and
    put it under the files in my html code so now the html code looks like this:

    <link href="CssFolder/CssScr.css" rel="stylesheet" type="text/css"/>
    <script language="javascript" src="JsFolder/JsScr.js"
    type="text/javascript"></script>
    <script language="javascript" src="JsFolder/jquery-1.4.2.min.js"
    type="text/javascript"></script>
    <script language="javascript" src="JsFolder/jquery-1.4.js"

    <script type="text/javascript">
    $(document).ready(function(){
    $("LinkButton").click(function(){
    $("p").hide();
    });
    });
    </script>

    Now it runs the same as before but nothing happens as if the code isn’t even
    there. Also this warning is present:

    Warning 121 Error updating JScript IntelliSense:
    C:\JQFolder\JQProj\JsFolder\jquery-1.4.2.min.js: Object doesn't support this
    property or method @ 33:0 C:\ JQFolder \ JQProj \JQMenu.aspx 1 1 JQProj

    I took this from a sample I saw that ran so why isn’t it running in my
    application?

    Thanks
    Jeff

    --
    JB
     
    JB, Sep 21, 2010
    #1
    1. Advertising

  2. JB wrote:

    > So I downloaded the JQuery library and added put it in the folder where my
    > old Javascript code was and added it beneath my Javascript file resides in
    > my html code:
    >
    > <link href="CssFolder/CssScr.css" rel="stylesheet" type="text/css"/>
    > <script language="javascript" src="JsFolder/JsScr.js"
    > type="text/javascript"></script>
    > <script language="javascript" src=" JsFolder/jquery-1.4.2.min.js"
    > type="text/javascript"></script>
    > <script language="javascript" src=" JsFolder/jquery-1.4.js"
    >
    > Next I added the following code to my JsScr.js file:


    Well the order matters, if your code in JsScr.js is supposed to use
    function or objects defined in the JQuery libraries then put the <script
    src="JsFolder/JsScr.js"></script> last.



    --

    Martin Honnen --- MVP Data Platform Development
    http://msmvps.com/blogs/martin_honnen/
     
    Martin Honnen, Sep 21, 2010
    #2
    1. Advertising

  3. JB

    Sharon Guest

    check the scr and the id

    "JB" wrote:

    > Hello Community
    >
    > Using ASP.Net with a separate CSS file and separate Javascript file my
    > applications work fine.
    >
    > Since JQuery offers features for web development I am substituting JQuery
    > where ever possible.
    >
    > So I downloaded the JQuery library and added put it in the folder where my
    > old Javascript code was and added it beneath my Javascript file resides in
    > my html code:
    >
    > <link href="CssFolder/CssScr.css" rel="stylesheet" type="text/css"/>
    > <script language="javascript" src="JsFolder/JsScr.js"
    > type="text/javascript"></script>
    > <script language="javascript" src=" JsFolder/jquery-1.4.2.min.js"
    > type="text/javascript"></script>
    > <script language="javascript" src=" JsFolder/jquery-1.4.js"
    >
    > Next I added the following code to my JsScr.js file:
    >
    > $(document).ready(function(){
    > $("LinkButton").click(function(){
    > $("p").hide();
    > });
    > });
    >
    > But I got an error stating:
    >
    > microsoft JScript runtime error: object expected
    >
    > and the code is highlighted.
    >
    >
    > Because I got that error message I moved the JQuery code the JsScr.js and
    > put it under the files in my html code so now the html code looks like this:
    >
    > <link href="CssFolder/CssScr.css" rel="stylesheet" type="text/css"/>
    > <script language="javascript" src="JsFolder/JsScr.js"
    > type="text/javascript"></script>
    > <script language="javascript" src="JsFolder/jquery-1.4.2.min.js"
    > type="text/javascript"></script>
    > <script language="javascript" src="JsFolder/jquery-1.4.js"
    >
    > <script type="text/javascript">
    > $(document).ready(function(){
    > $("LinkButton").click(function(){
    > $("p").hide();
    > });
    > });
    > </script>
    >
    > Now it runs the same as before but nothing happens as if the code isn’t even
    > there. Also this warning is present:
    >
    > Warning 121 Error updating JScript IntelliSense:
    > C:\JQFolder\JQProj\JsFolder\jquery-1.4.2.min.js: Object doesn't support this
    > property or method @ 33:0 C:\ JQFolder \ JQProj \JQMenu.aspx 1 1 JQProj
    >
    > I took this from a sample I saw that ran so why isn’t it running in my
    > application?
    >
    > Thanks
    > Jeff
    >
    > --
    > JB
     
    Sharon, Sep 21, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. EvgueniB
    Replies:
    1
    Views:
    656
    Anthony Borla
    Dec 15, 2003
  2. Frank Fredstone
    Replies:
    1
    Views:
    460
    Jean-Francois Briere
    Jun 27, 2006
  3. tshad
    Replies:
    2
    Views:
    346
    tshad
    Dec 14, 2007
  4. Aaron Gray
    Replies:
    20
    Views:
    415
    Lasse Reichstein Nielsen
    Jul 27, 2008
  5. lorlarz
    Replies:
    6
    Views:
    220
    David Mark
    Mar 25, 2010
Loading...

Share This Page