•
•
•
•
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 423,401 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 4,570 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: 666 | Replies: 3
![]() |
•
•
Join Date: Sep 2005
Location: St. Louis
Posts: 145
Reputation:
Rep Power: 4
Solved Threads: 0
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> 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.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
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.
Follow the links specified in this post and read them thoroughly.
I don't accept change. I don't deserve to live.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
Happiness corrupts people.
Failing to value the lives of others cheapens your own.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- IPB issues (Existing Scripts)
- Javascript and Firefox ISSUES (JavaScript / DHTML / AJAX)
- "<SCRIPT SRC>" javascript logon help (JavaScript / DHTML / AJAX)
- NEED HELP PLEASE!! with javascript issue. (JavaScript / DHTML / AJAX)
- JS opacity menu Problems In IE - rare (HTML and CSS)
- Help with javascript error with windows xp (Windows NT / 2000 / XP / 2003)
- Can't get Javascript to work (Web Browsers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: JavaScript Switch Statement Problems
- Next Thread: drag and drop with swapping



Linear Mode