• Howdy! Welcome to our community of more than 130.000 members devoted to web hosting. This is a great place to get special offers from web hosts and post your own requests or ads. To start posting sign up here. Cheers! /Peo, FreeWebSpace.net
managed wordpress hosting

Usefull JavaScripts

JavaScript Collector

Factors

Use JavaScript to find out if a number entered is odd or even and the factors of that number.... detail


Demo: Factors

How to setup

Step 1: Use JavaScript code below to setup the script
JavaScript
Code:
<SCRIPT LANGUAGE="JavaScript">
//Nicholas John Sullivan (nicholasjohnsullivan@hotmail.com)
<!-- Begin
function calc() {
var dnum = ((eval(document.res.inpa.value)) / 2);
var i;
var pol;
var inum = (Math.round(dnum));
if (inum == dnum) {
document.res.rses.value="Number: " + (eval(document.res.inpa.value)) + " is Even\n\n";
}
else {
document.res.rses.value="Number: " + (eval(document.res.inpa.value)) + " is Odd\n\n";
}
document.res.rses.value += "Factors Are:\n\n";
var num = Math.round(eval(document.res.inpa.value));
for (i = 2; i < (num / 2); i++) {
var chkd = Math.round(num / i);
var inn = Math.round(num / i);
var outt = (num / i);
if (inn == outt && chkd > i) {
document.res.rses.value = document.res.rses.value + "(" + (num/i) + "," + i + ")";
      }
   }
}
function numbersonly() {
if (event.keyCode < 48 || event.keyCode > 57) return false;
}
//  End -->
</script>
	<!--
    	This script downloaded from www.JavaScriptBank.com
    	Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
	-->

Step 2: Place HTML below in your BODY section
HTML
Code:
<form name="res">
<input type=text value="0" name="inpa" onkeypress="return numbersonly()">
<input type=button name="bt1" value="Calculate" onClick="calc()">
<br>
Results
<br>
<textarea name="rses" cols="20" rows="10" value="nothing"></textarea>
</form>
	<!--
    	This script downloaded from www.JavaScriptBank.com
    	Come to view and download over 2000+ free javascript at www.JavaScriptBank.com
	-->

Copyright said:
The Site may provide, or third parties may provide, links to non-JavaScriptBank.com Internet World Wide Web sites or resources. Because JavaScriptBank.com has no control over such sites and resources, you acknowledge and agree that JavaScriptBank.com is not responsible for the availability of such external sites or resources, and does not endorse and is not responsible or liable for any content, advertising, products, or other materials on or available from such sites or resources. You further acknowledge and agree that JavaScriptBank.com shall not be responsible or liable, directly or indirectly, for any damage or loss caused or alleged to be caused by or in connection with use of or reliance on any such content, goods or services available on or through any such site or resource.​
 
Developers and designers are using more and more JavaScript in modern designs. Sometimes this can be a hindrance to the user and take away from the simplicity of the design, and other times it can add greatly to the user’s experience. The key is a) adding the right amount of JavaScript, and b) using the right JavaScript techniques. We have already collected various JavaScript techniques in the past – now it’s time for a new portion of JavaScript.

Thanks to the Web’s widespread adoption of JavaScript, JavaScript libraries have sprung up to help make design and development easier. Here are a few of the major JavaScript libraries that developers use: jQuery, Prototype, Scriptaculous, mootools, Dojo. These frameworks have thriving communities whose members have developed countless plug-ins that can greatly add to the JavaScript framework.
 
Back
Top