PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

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

 
 
JB
Guest
Posts: n/a
 
      21st Sep 2010
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
 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      21st Sep 2010
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/
 
Reply With Quote
 
Sharon
Guest
Posts: n/a
 
      21st Sep 2010
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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
jquery .js file = windows authentication dialogue? Darrel Microsoft ASP .NET 2 12th Nov 2007 01:35 PM
Can I auto save to a separate file?(not the file I am working in) =?Utf-8?B?SmltIEx5bmNo?= Microsoft Excel Setup 1 14th Aug 2006 05:20 PM
all HTML Help file stop working Joe Windows XP Performance 1 8th Feb 2004 11:56 AM
all HTML Help file stop working Joe Windows XP Setup 1 8th Feb 2004 11:56 AM
all HTML Help file stop working Joe Windows XP General 1 8th Feb 2004 11:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:36 AM.