| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
|
|
#1 (permalink) |
|
::H4xx0r::
Join Date: Jun 2004
Location: UK
Posts: 57
|
Focus in JS
hey can someone help me with this <?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>JS Cal</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <SCRIPT type="text/javascript"> <!-- function a_div_b(form) { var a = eval(form.a.value); if(a < 2000 || b > 99999) { alert("Balance must be between 2000 and 99999 pound"); return; } var b = eval(form.b.value); if(b < 12 || b > 60) { alert("Term must be between 12 and 60 months"); return; } var c = a/b; form.ans.value = Math.round(c*100) / 100; } --> </SCRIPT> <style type="text/css"> body { font-family : arial; font-size : 10px; text-align : center; margin : 0px; } #bal { position : absolute; left : 432px; top : 10px; } #term { position : absolute; left : 355px; top : 32px; } #cal { position : absolute; left : 477px; top : 58px; } #pay { position : absolute; left : 428px; top : 78px; } .loginbutton { font-size : 11px; border : 1px dashed #000000; background-color : #666666; font-family : arial; color : #FFFFFF; } #container { height : 420px; width : 760px; background-color : #FFFFFF; margin : auto; position : relative; text-align : center; margin : 0px; } </style> </head> <body> <div id="container"> <FORM name="formx"> <div id="bal">Balance: <input type=text size=10 value=2000 name="a"> </div> <div id="term">Term(number of months): <input type="number" size=10 value=12 name="b"> </div> <div id="cal"> <input class="loginbutton" type="button" value=" Calculate " onClick="a_div_b(this.form)"> </div> <div id="pay">Payment: <input type "number" value=0 name="ans" size=10> </div> </FORM> </div> </body> </html> this is my simple calculation i would like the form b or when alert to return and focus on the b box which is terms can someone help me thank you |
|
|
|
![]() |