(追記) (追記ここまで)

Equivalent Fractions Calculator (Calc) in Javascript

Simple javascript calculator helps to calculate the equivalent fractions for the given numerators and denominators.

Features

  • Equivalent fraction defines the same part of the whole.
  • It can be generated by multiplying / dividing the numerator and denominator by the same number.
  • Online script which makes calculations easy and fast.
  • This is a free javascript calculator.

Preview

Equivalent Fractions Calculation

Enter Whole Numbers Only
Numerator/Denominator: /
©h
Equivalent Fractions
(追記) (追記ここまで)

Downloads

Code


<!-- Script by hscripts.com -->
<!-- More scripts @www.hscripts.com -->
<html>

<head>

<title>Equivalent Fractions Calculator in Javascript </title>
<script LANGUAGE="JavaScript" >
function calc() {
var n=document.getElementById("n").value;
var num=parseInt(n);
if (isNaN(num) || num <0) {
alert("Enter Numerator");
}
var n1=document.getElementById("n1").value;
var num2=parseInt(n1);
if (isNaN(num2) || num2 <0) {
alert("Enter Denominator");
}
for (var i=1;(i <num) ||(i == num);i++) {
if (num % i == 0) {
for (var j=1;(j <num2) ||(j == num2);j++) {
if (num2 % j == 0) {if( i ==j){
var m = Math.max(i,j);
}
var z = num/m;
var f = num2/m;
var z1=z*2;
var f1=f*2;
var z2=z*3;
var f2=f*3;
var z3=z*4;
var f3=f*4;
var z4=z*5;
var f4=f*5;
var z5=z*6;
var f5=f*6;
var z6=z*7;
var f6=f*7;
var z7=z*8;
var f7=f*8;
var z8=z*9;
var f8=f*9;
var z9=z*10;
var f9=f*10;
document.getElementById("res").value =
z + "/" + f+" , "+"" +z1 + "/" + f1+" , "+""+z2 + "/" + f2+" , "+""+z3 + "/" + f3+" , "+""+z4 + "/" + f4+" , "+""+z5 + "/" + f5+" , "+""+z6 + "/" + f6+" , "+""+z7 + "/" + f7+" , "+""+z8 + "/" + f8+" , "+""+z9 + "/" + f9 ;
}
}
}
}
}
function re()
{
document.getElementById("n").value ="";
document.getElementById("n1").value = "";
document.getElementById("res").value = "";
}
function checnum(as)
{
var dd = as.value;
if(dd.lastIndexOf(" ")>=0){dd = dd.replace(" ","");as.value = dd;
}
if(isNaN(dd))
{
dd = dd.substring(0,(dd.length-1));
as.value = dd;
}
}
function chk(){
var sds = document.getElementById('dum');
if(sds == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");
document.getElementById("maindiv").style.visibility="hidden";
}
var sdss = document.getElementById("dumdiv");
if(sdss == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");}
}
window.onload=chk;
</script>
<style>.frms textarea{min-height: 100px;font-family:Tahoma, Geneva, sans-serif;
padding:5px .5%;
line-height:18px;}textarea
{
width:99%;
height:auto;
background:#fff;
border:#ddd 1px solid;
border-radius:.35em;
-moz-border-radius:.35em;
-webkit-border-radius:.35em;
-o-border-radius:.35em;
padding:1% .5%;
margin-top:5px;
margin-bottom:15px;
}
h2 {border-bottom: 1px solid #ebebeb;color: #474747;font-size: 1.4em;font-weight: normal;line-height: 130%;
}
.frms
{
margin:0 auto;
padding:10px;
-moz-border-radius:.3em;
-webkit-border-radius:.3em;
-o-border-radius:.3em;
font-family:Tahoma, Geneva, sans-serif;
color:#333;
font-size:.9em;
line-height:1.2em;
}
.frms input[type="text"],[type="password"],[type="file"],textarea,select
{
width:99%;
background:#fff;
border:#ddd 1px solid;
border-radius:.35em;
-moz-border-radius:.35em;
-webkit-border-radius:.35em;
-o-border-radius:.35em;
padding:0 .5%;
margin-top:5px;
margin-bottom:15px;
height:35px;
}
.frms input:hover,textarea:hover,select:hover
{
box-shadow:#dae1e5 0px 0px 5px;
-moz-box-shadow:#dae1e5 0px 0px 5px;
-webkit-box-shadow:#dae1e5 0px 0px 5px;
-o-box-shadow:#dae1e5 0px 0px 5px;
}
.frms input:focus,textarea:focus,select:focus
{
-webkit-box-shadow: inset 7px 4px 7px -7px rgba(0,0,0,0.42);
-moz-box-shadow: inset 7px 4px 7px -7px rgba(0,0,0,0.42);
box-shadow: inset 7px 4px 7px -7px rgba(0,0,0,0.42);
border:#9d9983 1px solid;
}
.frms input[type="submit"],input[type="reset"],input[type="button"],button,.yellow_button,.blue_button
{
padding:7px 14px;
font-weight:bold;
color:#fff;
cursor:pointer;
border-radius:.3em;
-moz-border-radius:.2em;
-webkit-border-radius:.2em;
-o-border-radius:.2em;
margin:10px 0;
border:none;
}
.frms input[type="submit"]
{
background:#75ab22;
border-bottom:#629826 3px solid;
text-shadow:#396e12 1px 1px 0px;
}
.frms input[type="reset"]
{
background:#ee765d;
border-bottom:#d95e44 3px solid;
text-shadow:#8c3736 1px 1px 0px;
}
input[type="button"],button,.blue_button
{
background:#468cd2;
border-bottom:#3277bc 3px solid;
text-shadow:#214d73 1px 1px 0px;
}
.frms label
{
font-size:1.2em;
}
.resp_code
{
margin:5px 10px 10px 300px;
padding:10px 20px 10px 20px;
font:normal 1em/1.3em Tahoma, Geneva, sans-serif;
color:#333;
background:#f8f8f8;
border:#ddd 1px solid;
border-radius:.25em;
overflow:auto;width:50%;
}
table td{font-size: 0.8em;
}
@media screen and (max-width: 480px)
{
.resp_code
{width:auto !important;margin:0px !important;
}
}
</style>
</head><body>
<div class='resp_code' id='maindiv' align='center'><h2>Equivalent Fractions Calculation</h2><form name=first class='frms'>
<table width=100%><tr><td colspan=4><b>Enter Whole Numbers Only </b></td></tr><tr><td>Numerator/Denominator:</td><td> <input type=text id=n size=4 onkeyup=checnum(this) maxlength=7> </td><td> / </td><td><input type=text id=n1 size=4 onkeyup=checnum(this) maxlength=7></td></tr><tr><td colspan=4 align=center><input type=button value=Calculate onClick=calc()>
<input type=reset value=Reset onclick=re()><span
align='center' style="font-size: 10px;color: #dadada;" id="dumdiv"><a href="https://www.hscripts.com" id="dum" style="font-size: 10px;color: #dadada;text-decoration:none;color: #dadada;">&copy;h</a></span></td></tr><tr><td colspan=4><b>Equivalent Fractions</b></td></tr><tr><td colspan=4><textarea id=res cols=30 readonly></textarea></td></tr> </table></form>
</div>
</body>
</html>


  • Release Date - 16-04-2015
  • Get free version without ©copyright link for just 10ドル/-
  • For customization of this script or any script development, mail to support@hscripts.com

Usage

  • Copy the above code and paste in your webpage to use the equivalent fraction calc.
  • Calculate the equivalent fractions by entering the numerator and denominator value.
  • To use the functionality of the script alone, copy the code inside the script tag and integrate into your webpage.

License

Related Scripts

(追記) (追記ここまで)

Free Javascript Scripts


Ask Questions

Ask Question

AltStyle によって変換されたページ (->オリジナル) /