Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2012-03-16
2
Medium Priority
?
1,537 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 2000 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

Veeam Disaster Recovery in Microsoft Azure

Veeam PN for Microsoft Azure is a FREE solution designed to simplify and automate the setup of a DR site in Microsoft Azure using lightweight software-defined networking. It reduces the complexity of VPN deployments and is designed for businesses of ALL sizes.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …

972 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