Absolute Value of a Number

Absolute Value Script, which helps to find the absolute value of a number in javascript.

Features

  • Simple to calculate the absolute value from a number in javascript.
  • Helps to drop the sign of a number easily without any mathematical approach.
  • Fast, responsive and compact to use.
  • Supports all modern browsers.

Preview


Enter number

©

Downloads

Code


<!-- Script by hscripts.com -->
<!-- More scripts @www.hscripts.com -->
<html>
<head><title>Absolute Value of a Number | Responsive Javascript </title>
<script type='text/javascript'>
function onclk(){var aa=document.getElementById('num').value;
var s=Math.abs(aa);document.getElementById('absval').value = s;
}function check(ad){
ad.value = ad.value.replace(/([^-\d.]+)?((-{0,1}\d*\.?\d*)(.*)?$)/, "$3")}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("search").style.visibility="hidden";
}
}
window.onload=chk;
</script>
<style>.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%;
}
.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"]
{
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;
}
input[type="button"]
{
background:#468cd2;
border-bottom:#3277bc 3px solid;
text-shadow:#214d73 1px 1px 0px;
}
@media screen and (max-width: 480px)
{
.resp_code
{width:auto !important;margin:0px !important;
}
}
</style>
</head><body><div class='resp_code'>
<div class='frms' id='search'><div align='center'><label> <b>Find Absolute Value of a Number</b></label></div><br><div align='left'><b>Enter number</b></div><input type='text' name='absnum' id='num' maxlength='10' onkeyup='check(this)'><br><div align='center'><input type='button' id='btn' name='btnload' value='Click' onclick='onclk()'><span id="dumdiv" align="center" style=" font-size: 10px;color: #dadada;">
<a id="dum" style="padding-right:0px; text-decoration:none;color: green;" href="https://www.hscripts.com">&copy;h</a>
</span></div><br><input type='text' id='absval' readonly>
</div>
</div>
</body>
</html>



  • Release Date - 14-05-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 and paste the script code into your HTML page and run it.
  • This script is used to calculate the absolute value of a number.
  • Function 'onclk()' is used to get the absolute value of the number you have given.

License

Related Scripts

Free Javascript Scripts


Ask Questions

Ask Question