Solved

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

Posted on 2012-03-16
2
1,486 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
Comment Utility
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
Comment Utility
Looks like the problem was where I was loading more than one JQuery version.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now