JavaScript Scripts





Español Français 中文 Deutsch Portuguese Japanese nederlands
   
 
Free Java Script Codes
Javascript List All
Slide Show Slide Show
Ad Display Ad Display
Image Effect Image Effect
Animated Image Effects Animated Image Effects
Form Validation Form Validation
Color Picker Tool Color Picker Tool
Formatting Forms Formatting Forms
Select All Select All
Dynamic Form Select Dynamic Form select
Dynamic Color Dynamic Color
Calendar Script Calendar
Textbox Counter Textbox Counter
Alphanumeric Alphanumeric
Date Time Script Date & Time
Stop Watch Script Stop Watch script
Delete Repeated Values Delete Repeated Values
Pagination Pagination
Random Generator Random Generator
Animated Text Animated Text
Cursor Position Cursor Position
User Info Window / User Info
Security Security / Authenticate
Bookmark Bookmark
Mouse Effects Mouse Effects
Title Bar Title Bar
Status Bar Status Bar
Country List Country List
Free Games Free Games
Calculators Calculators
 




Javascript Prime Number Calculator


About
 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
a) You can verify whether the given value is integer or not.
b) Check given value is prime or not.
c) This is free javascript calculator.
d) 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      



Code
Javascript Code
<!-- Script by hscripts.com -->
<!-- Copyright of HIOXINDIA -->
<!-- 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="http://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 5 price

For customization of this script or any script development, contact us at support@hscripts.com


Usage
 a) Copy the javascript code into the head part of your HTML page.
 b) Create a HTML form using the above HTML code.
 c) 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.
 d) Copy the code into your page and use this calculator.



License
- The javascript (misspelled as java script) is given under GPL License
- i.e. Free use for those who use the codes as it is.
- Free, if your modification does not remove our copyright information and links.
- Click Here for detailed license information.
- You can purchase the script if your requirements does not meet our GPL License terms.
Other Links

web hosting