RSS Forums RSS
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting

JavaScript Issues

Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation: kahaj is an unknown quantity at this point 
Rep Power: 4
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  
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:36 am.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC