2 * This file is part of NOALYSS.
4 * NOALYSS is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * NOALYSS is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with NOALYSS; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20// Copyright Author Dany De Bontridder danydb@aevalys.eu
24 * This file show a little online calculator, in the caller the span id result,
25 * listing, the id form calc_line and the
32 * Compute and update the box
39 p_variable=this.document.getElementById('inp').value;
40 if (p_variable.search(/^\s*$/) !=-1)
47 p_variable=p_variable.replace(/[a-z]/,'');
48 p_variable=p_variable.replace(/[A-Z]/,'');
49 p_variable=p_variable.replace(/</,'');
50 p_variable=p_variable.replace(/%/,'');
51 p_variable=p_variable.replace(/;/,'');
52 p_variable=p_variable.replace(/>/,'');
53 p_variable=p_variable.replace(/ /g,"");
54 p_variable=p_variable.replace(/\+/g,"+ ");
55 p_variable=p_variable.replace(/-/g,"- ");
56 p_variable=p_variable.replace(/\//g,"/ ");
57 p_variable=p_variable.replace(/,/g,".");
60 var result=parseFloat(sub);
61 result=Math.round(result*10000)/10000;
65 alert_box(content[48]+p_variable);
68 p_history=p_variable+"="+result.toString()+'<br>'+p_history;
69 var str_sub='<p class="highlight"> '+p_variable+" = "+result.toString()+'</p>';
70 this.document.getElementById("sub_total").innerHTML=str_sub;
71 this.document.getElementById("listing").innerHTML=p_history;
72 this.document.getElementById('inp').value=result;
76function CleanHistory()
78 this.document.getElementById('listing').innerHTML="";
79 this.document.getElementById('sub_total').innerHTML="";
80 this.document.getElementById('inp').value="";
81 this.document.getElementById('inp').focus();
86 this.document.getElementById('inp').value="";
87 this.document.getElementById('inp').focus();
94 this.document.getElementById('inp').value="";
95 this.document.getElementById('inp').focus();