1 Replies - 2337 Views - Last Post: 03 June 2011 - 09:35 AM

#1 JamesConley  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 19
  • View blog
  • Posts: 341
  • Joined: 09-March 09

Microsoft JScript runtime error: Object expected

Posted 03 June 2011 - 08:47 AM

Hey Everyone!

So, Ive decided to do some tutorials and and work through Microsoft's Javascript Step by Step book. In doing so I have worked through this example and continue to get "Microsoft JScript runtime error: Object expected" I believe it's directing me to line 23 for the problem. My problem is that I do not know what the problem is. I'm assuming that I am missing something in regards to a setting in the IDE (VS 2010), which I am fairly new to. Not really sure...

Thanks in advance for help!

<%@ Page Title="Home Page" Language="C#"  AutoEventWireup="true"
    CodeBehind="Default.aspx.cs" Inherits="javascript._Default" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<!--Validation using the W3C’s Markup Validator tool-->
<html>
<head>
  <script type="text/javascript">
  function cubeme(incomingNum){
  if (incomingNum == 1)
  {
    return "What are you doing?"'
  }else{
    return Math.pow(incomingNum,3);
    }
  }
  </script>
  <title> A Chapter 3 Example</title>
</head>

<body>
<script type="text/javascript">
  var theNum = 2;
  var finalNum = cubeme(theNum);

  if (isNaN(finalNum)) {
    alert("You should know that 1 to the power is 1.");
  } else {
    alert("When cubed, " + theNum + " is " + finalNum);
  }
</script>
</body>
</html>]


This post has been edited by jpconleyiv: 03 June 2011 - 08:47 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Microsoft JScript runtime error: Object expected

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6111
  • View blog
  • Posts: 23,671
  • Joined: 23-August 08

Re: Microsoft JScript runtime error: Object expected

Posted 03 June 2011 - 09:35 AM

You have a syntax error here:

return "What are you doing?"'


That ' should be a ;
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1