Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/myscript/public_html/classes/classdb.php on line 42
FREE Javascript Prime Number Calculator, prime number checking,prime number calculation,using java script -HIOX
English

# Javascript Prime Number Calculator

Javascript Prime Number calculator is used to find whether the given value is prime or not. Enter the value into textbox and find whether the given value is prime or not.

# Features

• You can verify whether the given value is integer or not.
• Check given value is prime or not.
• This is free javascript calculator.
• Copy the code from given textarea and use this calculator.

# Preview

Enter value into Textbox to check whether it is prime or not.
Enter the value

# Downloads

Javascript Code

<!-- Script by hscripts.com -->
<!-- More scripts @www.hscripts.com --><script type="text/javascript">
function pricalc()
{
var a=frm.txt.value;
if(a=="")
alert("Enter the value");
else
{
var num=parseInt(a);
var i;
for(i=2;i<num;i++)
{
var n;
n=num%i;
if(n==0)
{
alert("Not a Prime Number");
break;
}
}
if(i==num)
{
alert("Prime Number");
} } } function isInteger(s)
{
var i;
s=s.toString(s);
for(i=0;i<s.length;i++)
{
var c=s.charAt(i);
if(isNaN(c))
{
alert("Given value is not a number");
frm.txt.value="";
return false;
}
}
return true; } </script><!-- Script by hscripts.com -->

HTML Code
<form name="frm"><input type=text name="txt" size=12 onKeyup="isInteger()" style="border-color:blue;">
<input type="button" name=cal value="check" onclick="pricalc()">
<div align=center>
&copy<a href="https://www.hscripts.com" style="color:#3D366F;text-decoration:none;cursor:pointer;font-size:13px">hscripts.com</a>
</div>
</form>

• Release Date - 07-04-2008
• 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 javascript code into the head part of your HTML page.
• Create a HTML form using the above HTML code.
• Here,the function "pricalc()" is called to check whether the given value is prime or not. The function "isInteger()" is used to check the entered value is integer or not.
• Copy the code into your page and use this calculator.

Ask Question