TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   Javascript, AJAX, E4X (http://www.talkphp.com/javascript-ajax-e4x/)
-   -   beginning js and getting errors. (http://www.talkphp.com/javascript-ajax-e4x/2961-beginning-js-getting-errors.html)

sarmenhb 06-15-2008 06:14 PM

beginning js and getting errors.
 
i cant see why this wont work do you see why? i am studying a video by vtc and it works for the guy on the pc. here is the html button.

the bugzilla error im getting is

missing ; before statement
[Break on this error] CashRegister.prototype = New Machine();\n

performtest is not defined
onclick(click clientX=0, clientY=0)



<input type="button" name="PerformTest" value="Perform Test" onclick="javascript:performtest()">


here is the performtest function in a seperate js file

Code:

function Machine()
{
       
        this.startingCash = 0;
        this.usedbyemployee = "Employee has not been assigned";
}

function CashRegister()
{
        this.startingcash = 1000;
        this.tax = .07;
}

        CashRegister.prototype = New Machine();
       
       
       
CashRegister.prototype.getStartingCash = function()
 {
                return this.startingCash;
 }
 
 
CashRegister.prototype.getUsedByEmployee = function()
{
        return this.usedbyemployee;
}

function performtest()
{
        var myCashRegister = new CashRegister();
       
        alert("The Starting Cash is: " + myCashRegister.getStartingCash());
       
        alert("The Used by Employee Cash is: " + mycashregister.getusedbyemployee();

}


Salathe 06-15-2008 06:26 PM

The missing ; before statement error was being generated because your New should not be capitalised, new Machine() works just fine. There are also a number of other errors mostly centred around improper capitalisation of the method/instance names.

Aaron 06-15-2008 08:26 PM

one word: Firebug

It's the only reason I use firefox. You'll understand when you start using it. Get the older version though, the new one kinda sucks.

delayedinsanity 06-16-2008 02:55 AM

The only reason?

How about better support for all the current w3c recommendations? Or less memory leaks? Or just... it's plain better.
-m

Aaron 06-21-2008 03:51 AM

There are browsers with better support

memory leaks? Have you checked the memory that firefox uses normally? It's more than hours of leaks off IE.

As for your last argument, that's just an opinion. Internet Explorer does it's job well; it surfs the web. Even if as a developer I hate IE, as an internet user it serves my needs perfectly.

I'm not even getting into Opera, Safari, Konquerer, Epiphany, or Dillo.


All times are GMT. The time now is 04:06 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0