User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,383 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,063 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 636 | Replies: 3
Reply
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation: kahaj is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
kahaj kahaj is offline Offline
Junior Poster

Help JavaScript Issues

  #1  
Oct 31st, 2007
I've been trying for the past hour to iron out the issue(s) with this. I keep thinking that I have it just about there, try to change something here or there and still don't have it working. ANY help I could get on this would be so fantastic.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtmll/DTD/xhtmll-transitional.dtd">
<html />
<head />
<title />Gross Salary Calculator</title>
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
var hours = "";
	if (hours = >40)
	window.alert("<p>Your regular hours must be 40 or less.<br />Anything above that should go into the overtime field.</p>");
var ot = "";
	if (hours = <40)
	window.alert("<p>In order to be paid overtime, you must enter 40 in the hours field.</p>");
var hourly = 14.38;
var total = "";
function updateTotal(value) {
	total += value;
	document.Gross_Pay.Input.value = total;
	}
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</head>
<body />

<p><h3>Enter the hours you worked this week below.<br />
If you worked no overtime this week, leave the "0" indicating such.<br />
Your pay will be determined based on your $14.38 hourly pay rate.</h3></p><br /><br />

<table width="80%" border="0" align="center" cellspacing="5">
<tr><td width="30%">
<form name="Gross_Pay" action="" />
<label>Hours:<br />
<input type="text" name="hours" size="3" maxlength="2" /><br /><br /></label>
<label>Overtime:<br />
<input type="text" name="ot" size="3" maxlength="2" value="0" /><br /><br /></label>
<input type="button" name="calc" value="Calculate" onclick="document.Gross_Pay.Input.value=eval(total); total='(hours * hourly) + (hourly * 1.5 * ot)'" />
</form>
</td>

<td width="70%" valign="top" halign="left">
<script type="text/javascript">
<!-- HIDE FROM INCOMPATIBLE BROWSERS
document.write("<p> Your gross pay for this week<br /> will be " + total + "</p>");
// STOP HIDING FROM INCOMPATIBLE BROWSERS -->
</script>
</td></tr></table>

</body>
</html>
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,811
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 339
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: JavaScript Issues

  #2  
Oct 31st, 2007
First validate your document against your DOCTYPE here, do away with the issues which the validator spits out and then repost. I guess this is the second time I would be telling you that <html /> is incorrect. The validator ought to tell you a lot about your code.
Last edited by ~s.o.s~ : Oct 31st, 2007 at 12:05 pm.
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation: kahaj is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
kahaj kahaj is offline Offline
Junior Poster

Re: JavaScript Issues

  #3  
Oct 31st, 2007
Okay, it has passed. Now, when I attempt to run it, I'm told that Line 37, Character 1 has an error & that document.Gross_Pay.Input is null or not an object.
Reply With Quote  
Join Date: Jun 2006
Location: India
Posts: 6,811
Reputation: ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold ~s.o.s~ is a splendid one to behold 
Rep Power: 23
Solved Threads: 339
Moderator
Featured Poster
~s.o.s~'s Avatar
~s.o.s~ ~s.o.s~ is offline Offline
Rebellion Revamped

Re: JavaScript Issues

  #4  
Oct 31st, 2007
Javascript is case sensitive. And anyways there is no property input, it's 'value'. And the way you are accessing form elements is wrong.

Follow the links specified in this post and read them thoroughly.
"I don't accept change. I don't deserve to live."

"Working a real job is a win if you're lazy, greedy, or unmotivated. If you're average, you fit right in. And if you're above average, the basic terms of employment and premise of the arrangement is against your interests."
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb JavaScript / DHTML / AJAX Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the JavaScript / DHTML / AJAX Forum

All times are GMT -4. The time now is 1:04 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC