willemvo
New Member
- Messages
- 19
- Reaction score
- 0
- Points
- 0
HTML:
<html>
<head>
<title>Test JavaScript</title>
<script lang="JavaScript">
<!--
//********************************************\\
//******script made by willem van oort ©2008******\\
//*********************************************\\
bereken(form)
var purchase = form.purchase.value;
var selling price = form.selling price.value;
var bruto = selling price - purchase;
var driving costs = form.driving costs.value;
var left = form.left.value;
var production costs = form.production costs.value;
var netto = selling price - purchase - driving costs - left - production costs;
-->
</script>
<style lang="text/css">
p {
font-family:times new roman, arial;
}
h1 {
font-family:times new roman, arial;
}
</style>
</head>
<body>
<input type="text" name="purchase" value="purchase" size="20" onfocus="if (this.value=='purchase') {this.value=''}" onblur="if (this.value=='') {this.value='purchase'}"><br>
<input type="text" name="selling price" value="selling price" size="20" onfocus="if (this.value=='selling price') {this.value=''}" onblur="if (this.value=='') {this.value='selling price'}"><br>
<input type="text" name="production costs" value="production costs" size="20" onfocus="if (this.value=='production costs') {this.value=''}" onblur="if (this.value=='') {this.value='production costs'}"><br>
<input type="text" name="left" value="left" size="20" onfocus="if (this.value=='left') {this.value=''}" onblur="if (this.value=='') {this.value='left'}"><br>
<input type="text" name="driving costs" value="Rij-Kosten" size="20" onfocus="if (this.value=='Rij-Kosten') {this.value=''}" onblur="if (this.value=='') {this.value='Rij-Kosten'}"><br>
<input type="button" name="button" onClick="bereken(this.form)" value="bereken!">
<script lang="JavaScript">
<!--
//********************************************\\
//******script made by willem van oort ©2008******\\
//*********************************************\\
document.write("<br>purchase: €" +purchase);
document.write("<br>selling price: €" +selling price);
document.write("<br>Bruto profit: €" +bruto);
document.write("<br>production costs: €" +production costs);
document.write("<br>Rij-kosten: €" +driving costs);
document.write("<br>left: €" +left);
document.write("<br>Netto profit: €" +netto);
if(netto > 0){
document.write("<p>There was profit");
} else if (netto == 0) {
document.write("<p>There was no profit");
} else {
document.write("<p>There was a negative profit");
}
-->
</script>
</body>
</html>