OZONE Asylum
Forums
DHTML/Javascript
JS Function & Variable Storage
This page's ID:
27926
Search
QuickChanges
Forums
FAQ
Archives
Register
Edit Post
Who can edit a post?
The poster and administrators may edit a post. The poster can only edit it for a short while after the initial post.
Your User Name:
Your Password:
Login Options:
Remember Me On This Computer
Your Text:
Insert Slimies »
Insert UBB Code »
Close
Last Tag
|
All Tags
UBB Help
Couldn't resist:[small][code]<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" > <head> <title>Test</title> <script type="text/javascript"> var running_total=0; function calculateCharges( hoursArgument ) { var hours= parseFloat(hoursArgument); if( isNaN(hours) || hours<=0 ) { alert( "** ERROR **" ) return false; } var current_charges; if ( hours <= 3 ) current_charges = 2; else if ( hours > 3 && hours <= 19) current_charges = 2 + (0.50 * (hours - 3)); else current_charges = 10; running_total += current_charges; document.getElementById('currentWage').firstChild.nodeValue = current_charges; document.getElementById('runningWage').firstChild.nodeValue = running_total; return true; } </script> </head> <body> <form action=""> <fieldset> <legend>Please enter the number of hours parked for the current customer:</legend> <input type="text" name="hoursparked" value="0" /> <button type='button' onclick='calculateCharges(this.form.hoursparked.value)' >Calculate charges</button> </fieldset> </form> <p>Charges for current customer: <span id='currentWage'>0</span></p> <p>Accumulated charges: <span id='runningWage'>0</span></p> </body> </html>[/code][/small] [url=http://www.p01.org/][img]http://poi.ribbon.free.fr/files/p01_ozoneasylum_sig_galaxy.gif[/img][/url] [small](Edited by [url=http://www.ozoneasylum.com/user/2185]poi[/url] on 05-14-2006 11:52)[/small]
Loading...
Options:
Enable Slimies
Enable Linkwords
« Backwards
—
Onwards »