Solved

Microsoft JScript runtime error: Object doesn't support this propety or method.

Posted on 2012-03-16
2
1,496 Views
Last Modified: 2012-03-18
I'm working on a new website using ASP.NET MVC 3 and JQuery. I actually started with the HTML 5 Mobile ready website template that's available on NuGet.

I trying to use JQuery.sparkliine.js library to do some charting. When I run it in Visual Studio 2010 I get the error in the: Microsoft JScript runtime error: Object doesn't support this propety or method. and it stops at this line....

             $('.inlinesparkline').sparkline();


<!DOCTYPE html>
<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="en"> <![endif]-->
<!--[if IE 7 ]>    <html class="ie ie7 no-js" lang="en"> <![endif]-->
<!--[if IE 8 ]>    <html class="ie ie8 no-js" lang="en"> <![endif]-->
<!--[if IE 9 ]>    <html class="ie ie9 no-js" lang="en"> <![endif]-->
<!--[if gt IE 9]><!--><html class="no-js" lang="en"><!--<![endif]-->
<!--[if lt IE 9]>
<script src="@Url.Content("~/Scripts/html5.js")"></script>
<![endif]-->
<!-- the "no-js" class is for Modernizr. -->

<head>
   <meta charset="utf-8">
	
	<meta name="description" content="The content description">
   <link rel="shortcut icon" href="@Url.Content("~/Content/images/favicon.ico")">
	

    <title>@ViewBag.Title</title>
@*    <link href="@Url.Content("~/css/Html5Reset.css")" rel="stylesheet"/>
*@    <link href="@Url.Content("~/css/Site.css")" rel="stylesheet"/>
      
     <!-- Grab Google CDN's jQuery. fall back to local if necessary -->
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.4.4.js"></script>
<script> window.jQuery || document.write(unescape("%3Cscript src='@Url.Content("~/Scripts/jquery-1.6.2.min.js")'%3E%3C/script%3E"))</script>
  
    <script src="@Url.Content("~/Scripts/modernizr-2.0.6.js")"></script>
    <script src="@Url.Content("~/Scripts/jquery.sparkline.js")"></script>
    
     <script type="text/javascript">
         $(function () {
             /** This code runs when everything has been loaded on the page */
             /* Inline sparklines take their values from the contents of the tag */
             $('.inlinesparkline').sparkline();

             /* Sparklines can also take their values from the first argument 
             passed to the sparkline() function */
             var myvalues = [10, 8, 5, 7, 4, 4, 1];
             $('.dynamicsparkline').sparkline(myvalues);

             /* The second argument gives options such as chart type */
             $('.dynamicbar').sparkline(myvalues, { type: 'bar', barColor: 'green' });

             /* Use 'html' instead of an array of values to pass options 
             to a sparkline with data in the tag */
             $('.inlinebar').sparkline('html', { type: 'bar', barColor: 'red' });
         });
    </script>

</head>

<body id="page">
   <!-- Begin the page section with the section tag -->

   
<p>
Inline Sparkline: <span class="inlinesparkline">1,4,4,7,5,9,10</span>.
</p>
<p>
Sparkline with dynamic data: <span class="dynamicsparkline">Loading..</span>
</p>
<p>
Bar chart with dynamic data: <span class="dynamicbar">Loading..</span>
</p>
<p>
Bar chart with inline data: <span class="inlinebar">1,3,4,5,3,5</span>
</p>

      <!-- body of the pages should start with section class="content" -->      

@RenderBody()

        <footer id="pageFooter"> <!--begin master footer -->
          
           <h4 class="stylishHeader">@Html.Raw( string.Format("{0} {1} {2}" ,"&copy;",DateTime.Now.Year,"Xoikos.com"))</h4> 
           
@*           <a href="http://www.w3.org/html/logo/" class="nobg">
<img src="http://www.w3.org/html/logo/badge/html5-badge-h-connectivity-css3-device-graphics-multimedia-performance-semantics-storage.png" width="357" height="64" alt="HTML5 Powered with Connectivity / Realtime, CSS3 / Styling, Device Access, Graphics, 3D &amp; Effects, Multimedia, Performance &amp; Integration, Semantics, and Offline &amp; Storage" title="HTML5 Powered with Connectivity / Realtime, CSS3 / Styling, Device Access, Graphics, 3D &amp; Effects, Multimedia, Performance &amp; Integration, Semantics, and Offline &amp; Storage">
</a>*@
           
        </footer><!--end master footer -->
            
		
    <!-- Grab Google CDN's jQuery. fall back to local if necessary -->
<script src="http://ajax.aspnetcdn.com/ajax/jquery/jquery-1.6.2.min.js"></script>
<script> window.jQuery || document.write(unescape("%3Cscript src='@Url.Content("~/Scripts/jquery-1.6.2.min.js")'%3E%3C/script%3E"))</script>

   @RenderSection("scripts",false)
   
</body>
</html>

Open in new window

0
Comment
Question by:dgerler
2 Comments
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 500 total points
ID: 37732429
You load an old jQuery, then you test if jQuery is loaded - if not you then load a NEWER jQuery???

Why not just load

http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js

then you always get the latest

Also Modernizr is version 2.5.3

That said, sparklines is 2010 so perhaps it does not want the latest stuff and this question may even have nothing to do with jQuery but more to do with visual studio of which I have no knowledge
0
 

Author Closing Comment

by:dgerler
ID: 37735565
Looks like the problem was where I was loading more than one JQuery version.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question