leaveoutalltherest: (Default)
[personal profile] leaveoutalltherest
Yes, I'm coming to my flist for homework help.

This is for my Web Programming class, learning XHTML.



Assignment is: Create a JavaScript program that calculates an employee's weekly gross salary, based on the number of hours worked and hourly wage entered by the user. Compute any hours over 40 as time-and-a-half. Display the results in an alert dialog box. Save the file as Wages.html.

Okay, I did all of that. The damn file validated at http://validator.w3.org like it was supposed to. But when I open the page in my browser (tried both IE and Firefox) and enter the info and click on the button, it tells me 'script error'. I can't figure out what I did wrong because the other file I did that was almost exactly like it, works.

Here's what I have:




Help?

(no subject)

Date: 2006-11-10 11:16 pm (UTC)
ext_26799: (hollow heroes)
From: [identity profile] nique.livejournal.com
Urg. Can't help much... I learned C++, and that was almost six years ago now. I don't see anything glaring, but if that were the problem, the validator would have caught it, I suppose. Sorry. :(

(no subject)

Date: 2006-11-11 04:05 am (UTC)
From: [identity profile] slaarti.livejournal.com
If you're using Firefox, then you should be able to find, under the Tools menu, the handy dandy little helper known as the "JavaScript Console". Select that and have it open when you load up the HTML file, enter in numbers, and click the button... and it'll tell you, "Error: document.salary has no properties" and that the error occurred at line 10 of the page.

More specifically, the root of the problem is that your JavaScript code believes that the name of the form in the document is "salary", while the document itself names the form "wages". Pick one or the other and make them all match, and I think you'll find that everything else is just fine.

Profile

leaveoutalltherest: (Default)
Kym

September 2017

S M T W T F S
     12
3456789
1011121314 1516
17181920212223
24252627282930

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags