Solved

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

Posted on 2012-03-16
2
1,491 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 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