Friday, 18 September 2015
FRACTION CALCULATOR CODE


-----------------------------------------------------------------------------------------------------------------
COPY AND PASTE BELOW CODE IN POST HTML SECTION
------------------------------------------------------------------------------------------------------------------
<html>
<head>
<script type="text/javascript">
function launch(file)
{
hwnd = window.open(
file,"calc","toolbar=no,directories=no,menubar=no, width=600,height=170");
hwnd = window.open(file,"calc");
}
function intDivide( n1, n2 ){
var n = 0;
while (n1 >= n2 ){
n++;
n1 -= n2;
}
return n;
}
//--- Reduce or Simplify fraction
//--- Determine greatest common divisor
function simplify( n1, n2 )
{
var min = ( n1 > n2 ) ? n2 : n1;
var gcd =1;
for( var i=1;i<=min; i++) if ( ( n1 % i == 0 ) && ( n2 % i ) == 0 ) gcd =i;
f = ( n1 / gcd ) + "/" + ( n2 / gcd );
return f;
}
function Calculate(){
var n = 0;
var d = 0;
var n1 = 0;
var d1 = 0;
var x1 = 0;
var f1 = document.forms["fraction"].f1.value;
var p1 = f1.indexOf("/");
var s1 = f1.indexOf(" ");
window.status ="Working on problem...";
if ( p1 > 0 ){
if (s1 > 0){
x1 = eval( f1.substring( 0, s1 ) ); // The whole number portion
n1 = eval(f1.substring(s1, p1) );
d1 = eval( f1.substring( p1 + 1 ) );
n1 = n1 + (d1 * x1);
}
else {
n1 = eval( f1.substring( 0, p1 ) );
}
d1 = eval( f1.substring( p1 + 1 ) );
if( d1==0){
alert("Denominator CAN NOT be '0' in the first fraction!");
return false
}
} else if ( ( f1 != null ) && ( eval( f1 ) != 0 ) ){
n1 = eval( f1 );
d1 = 1;
} else {
alert("First fraction IS NOT correct!");
return false;
}
var n2 = 0;
var d2 = 0;
var x2 = 0;
var f2 = document.forms["fraction"].f2.value;
var p2 = f2.indexOf("/");
var s2 = f2.indexOf(" ");
if ( p2 > 0 ){
if (s2 > 0){
x2 = eval( f2.substring( 0, s2 ) ); // Whole number part
n2 = eval(f2.substring(s2, p2) );
d2 = eval( f2.substring( p2 + 1 ) );
n2 = n2 + (d2 * x2);
}
else {
n2 = eval( f2.substring( 0, p2 ) );
}
d2 = eval( f2.substring( p2 + 1 ) );
// d2 = eval( f2.substring( p2 + 1 ) );
if( d2==0){
alert("Denominator CAN NOT be '0' in the second fraction!");
return false
}
} else if ( ( f2 != null ) && ( eval( f2 ) != 0 )){
n2 = eval( f2 );
d2 = 1;
} else {
alert("Invalid Second Fraction");
return false;
}
if (document.forms["fraction"].f[0].checked ) {
n = n1 * d2 + n2 * d1;
d = d1 * d2;
}
else if (document.forms["fraction"].f[1].checked ) {
n = n1 * d2 - n2 * d1;
d = d1 * d2;
} else if (document.forms["fraction"].f[2].checked ) {
n = n1 * n2;
d = d1 * d2;
} else if (document.forms["fraction"].f[3].checked ) {
n = n1 * d2;
d = d1 * n2;
}
//--- Show mixed number if possible
var n3 = Math.abs( n );
var d3 = Math.abs( d );
var out = "";
var wh = 0;
var exc = false;
if ( (( n < 0 ) || ( d < 0 )) && (( n > 0 ) || ( d > 0 )) ) exc = true;
if ( n3 >= d3 ){
//--- Find whole number portion
wh = intDivide( n3, d3 );
if ( exc ) wh = -wh;
out = wh.toString();
}
n3 = n3 % d3;
if ( n3 > 0 ) {
var f4 = simplify( n3, d3 );
p = f4.indexOf("/");
n = eval( f4.substring( 0, p ) );
d = eval( f4.substring( p + 1 ) );
if ( wh != 0 ) out += " ";
if ( wh == 0 && exc ) n = -n;
out += n.toString() + "/" + d.toString();
}
document.forms["fraction"].f3.value = out;
window.status = "Calculation is Complete!";
return true;
}
</script>
</head>
<body>
<div class="fusion-fullwidth fullwidth-box" style="background-color:#ffffff;background-attachment:scroll;background-position:left top;background-repeat:no-repeat;-webkit-background-size:cover;-moz-background-size:cover;-o-background-size:cover;background-size:cover;border-color:#eae9e9;border-bottom-width: 0px;border-top-width: 0px;border-bottom-style: solid;border-top-style: solid;padding-bottom:20px;padding-left:0px;padding-right:0px;padding-top:20px;">
<div class="avada-row">
<div class="fusion-title title">
<h1 class="title-heading-left"><strong>Quick Fraction Calculator</strong></h1>
<div class="title-sep-container">
<div class="title-sep sep-single"></div>
</div>
</div>
<div class="fusion-one-half one_half fusion-layout-column fusion-column spacing-yes">
<div class="fusion-column-wrapper"><b>Solve fraction problems, including improper fractions, mixed numbers and whole numbers.</b>All answers are given in the reduced form.
<p></p>
<h2>Fraction Calculator Instructions</h2>
<ol class="ol1">
<ol class="ol1">
<ol class="ol2">
<li class="li3"><span style="color: #333333;">Enter each fraction in the fields provided (formatted like 1/3, 2 7/8, or 7/5)</span></li>
<li class="li3"><span style="color: #333333;">Select the operation you wish to perform (i.e. Add, Subtract, Multiple, or Divide)</span></li>
<li class="li3"><span style="color: #333333;">Finally, click on the “Calculate” button to see the result</span></li>
</ol>
</ol>
</ol>
<h2>Tips</h2>
<p><b>For mixed numbers, be sure to leave a space between the whole number and the fractional part (i.e. 2 1/4 or 7 1/8, etc.)</b><i><strong> NOTE:</strong> Do not put minus signs in this calculator.</i></p>
</div>
</div>
<div class="fusion-one-half one_half fusion-layout-column fusion-column last spacing-yes">
<div class="fusion-column-wrapper">
<br>
<form name="fraction">
<div align="center">
<table bordercolor="#cccccc" height="181" cellspacing="0" cellpadding="4" width="300" border="1">
<tbody>
<tr>
<td width="214" height="10" align="left" bgcolor="#CCCCCC"><b><font color="#000000">Fraction #1 </font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="4"> <input maxlength="10" size="7" name="f1" width="10" style="font-size: 14pt; font-weight: bold; word-spacing: 5"> </font><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></td>
<td width="213" height="10" align="left" bgcolor="#CCCCCC"><b><font color="#000000">Fraction #2 </font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="4"> <input maxlength="10" size="8" name="f2" width="10" style="font-size: 14pt; font-weight: bold; word-spacing: 5"> </font></td>
</tr>
<tr>
<td height="26" align="left" bgcolor="#CCCCCC"><font color="#000000"> <input type="radio" checked="" value="add" name="f"> Add</font></td>
<td height="26" align="left" bgcolor="#CCCCCC"><font color="#000000"> <input type="radio" value="multiply" name="f"> Subtract</font></td>
</tr>
<tr>
<td height="26" align="left" bgcolor="#CCCCCC"><font color="#000000"> <input type="radio" value="subtract" name="f"> Multiply</font></td>
<td height="26" align="left" bgcolor="#CCCCCC"><font color="#000000"> <input type="radio" value="divide" name="f"> Divide</font></td>
</tr>
<tr>
<td height="26" colspan="2" align="center" bgcolor="#CCCCCC"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="4"> <input style="font-weight: bold; font-size: 14pt" onclick="Calculate();" type="button" value="Calculate" name="calculate"> </font></b><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><p></p></font>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> </font><font face="Verdana, Arial, Helvetica, sans-serif" size="4"><b> <input maxlength="10" size="15" name="f3" width="10" style="font-size: 14pt; font-weight: bold; text-align: Center; word-spacing: 5"> </b></font><font face="Verdana, Arial, Helvetica, sans-serif" size="2"></font></p>
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <input style="font-weight: bold; font-size: 14pt" type="reset" value="Reset" name="B1"> </font></p>
</td>
</tr>
</tbody>
</table>
</div>
<p></p>
</form>
<p> </p>
</div>
</div>
<div class="fusion-clearfix"></div>
</div>
</div>
<p></p>
</body>
</html>
Related movie you might like to see :

COMMENTS REMOVER

FILE SAVE AS WITH JAVA SCRIPT METHO...

FILE SAVE AS WITH JAVA SCRIPT METH...

HTML CSS JAVA COMPRESSOR CODE

HTML CSS JAVA COMPRESSOR

ONLINE CSS UNMINIFIER CODE

ONLINE CSS UNMINIFIER

CSSO (CSS Optimizer)

SCRIPT TUTORIALS CSSO CSS COMPOSER ...

WHITE SPACE REMOVER CODE

White Space Remover

COMMENTS REMOVER CODE
?
+
X
Recommended for you
Loading..
Related Post for FRACTION CALCULATOR CODE
PERCENT CALCULATOR PIE CHART .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
GREATEST COMMON FACTOR CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
ADDING SUBTRACTING 3 FRACTION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
CIRCLE CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION -------------…
MEAN MEDIAN MODE RANGE CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, Ar…
LONG DIVISION CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
ADDING SUBTRACTING FRACTION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
ADDING SUBTRACTING FRACTION CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
ADDING SUBTRACTING 3 FRACTION CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
PRIME NUMBER GENERATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
SCIENTIFIC NOTATION CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana,…
MEAN MEDIAN MODE RANGE CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
MULTIPLYING FRACTIONS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
MATH FRACTION REDUCER CALCULATOR CODE ---------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
DIVIDING FRACTIONS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana,…
PERCENT CALCULATOR PIE CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
EXPONENT CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
LINEAR EQUATION SOLVER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
SLOPE CALCULATOR WITH GRAPH CODE ---------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
LCM CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
LCM CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION -----------…
CIRCLE CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
PRIME FACTORING CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
EXPONENT CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
LINEAR EQUATION SOLVER .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
PRIME NUMBER CHECKER CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
COMPARE FRACTIONS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana,…
COMPARE FRACTIONS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION --------------…
PRIME NUMBER CHECKER .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
MULTIPLYING FRACTIONS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, Ar…
LONG DIVISION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
FIND AND REPLACE TEXT /* general */ * { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } ::-moz-selection { background: #000; text-shadow: none; color: #ff…
FACTORING CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
PRIME NUMBER GENERATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
PRIME FACTORING CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, …
FACTORING CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
SCIENTIFIC NOTATION CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
SLOPE CALCULATOR WITH GRAPH .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
MATH FRACTION REDUCER CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana, A…
FIND AND REPLACE TEXT CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION -------------…
ADDING SUBTRACTING MIXED NUMBERS CALCULATOR .CalcTable { padding: 4px 6px; border: solid #ddd 1px; border-collapse: collapse } .CalcTitleCell { background-color: transparent; color: #1d487e; font-family: Verdana…
ADDING SUBTRACTING MIXED NUMBERS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
DIVIDING FRACTIONS CALCULATOR CODE ----------------------------------------------------------------------------------------------------------------- COPY AND PASTE BELOW CODE IN POST HTML SECTION ---------------…
Labels:
TEXT TOOLS
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment
Click to see the code!
To insert emoticon you must added at least one space before the code.