275 lines
10 KiB
HTML
275 lines
10 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
|||
|
<HTML>
|
|||
|
<HEAD>
|
|||
|
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|||
|
<!-- (C) Copyright IBM Corporation, 2005 -->
|
|||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
|||
|
<!-- US Government Users Restricted Rights -->
|
|||
|
<!-- Use, duplication or disclosure restricted by -->
|
|||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
|||
|
<TITLE>TCP/IP subnet calculator</TITLE>
|
|||
|
<link rel="stylesheet" type="text/css" href="../rzahg/ic.css">
|
|||
|
|
|||
|
<SCRIPT language="JavaScript" type="text/javascript">
|
|||
|
<!-- //////////
|
|||
|
|
|||
|
var loopbackmessage = "The 127 network address is reserved for loopback addresses. Do you want to continue?";
|
|||
|
var numericmessage = "Network addresses consist of numeric characters only. Enter a numeric network address";
|
|||
|
var classbmessage1 = "The first segment of your network address belongs to a class B address. To use this subnet calculator, the third segment of a class B address must be 0";
|
|||
|
var classamessage = "The first segment of your network address belongs to a class A address. To use this subnet calculator, the second and third segment of a class A address must be 0";
|
|||
|
var nonumeric2 = "Each segment must have a numeric IP address.";
|
|||
|
var segment1message1 = "Segment 1 must be greater than 1 and less than 256";
|
|||
|
var segment2message1 = "Segment 2 must be greater than or equal to 0 and less than 256";
|
|||
|
var segment3message1 = "Segment 3 must be greater than or equal to 0 and less than 256";
|
|||
|
var classbmessage3 = "The first segment of your network address belongs to a class B address. To use this subnet calculator, the second segment of a class B address must be greater than 0";
|
|||
|
var classcmessage1 = "The first segment of your network address belongs to a class C address. To use this subnet calculator, the second segment of your network address cannot equal 0";
|
|||
|
var classcmessage2= "The first segment of your network address belongs to a class C address. To use this subnet calculator, the third segment of your network address cannot equal 0";
|
|||
|
var nonumeric3 = "Network addresses consist of numeric characters only. Enter a numeric network address";
|
|||
|
var nonumeric4 = "Network addresses consist of numeric characters only. Enter a numeric network address";
|
|||
|
var numericmessage1 = "You must only enter integers";
|
|||
|
|
|||
|
//START NON-TRANSLATABLE
|
|||
|
function sender() {
|
|||
|
var newsegment1 = parent.hidden.data[1]
|
|||
|
|
|||
|
if (newsegment1 <= 127) {
|
|||
|
// Send to Class A choices
|
|||
|
window.location = "rzak1advsub18.htm";
|
|||
|
}
|
|||
|
|
|||
|
if (newsegment1 >= 128 && newsegment1 <= 191) {
|
|||
|
// Send to Class B choices
|
|||
|
window.location = "rzak1advsub20.htm";
|
|||
|
}
|
|||
|
|
|||
|
if (newsegment1 >= 192) {
|
|||
|
// Send to Class C choices
|
|||
|
window.location = "rzak1advsub25.htm";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Update the fields based on first segment entries. Also do one syntax check.
|
|||
|
|
|||
|
function updateData(form) {
|
|||
|
var newseg1 = form.segment1.value
|
|||
|
var loopcheck = parseInt(newseg1)
|
|||
|
|
|||
|
// class A
|
|||
|
|
|||
|
if (newseg1 < 127 && newseg1 >= 1) {
|
|||
|
form.segment3.value = 0;
|
|||
|
form.segment2.value = 0;
|
|||
|
} else {
|
|||
|
// class B
|
|||
|
if (newseg1 >= 128 && newseg1 <= 191) {
|
|||
|
form.segment2.value = "";
|
|||
|
form.segment3.value = 0;
|
|||
|
} else {
|
|||
|
// class C
|
|||
|
if (newseg1 > 191 && newseg1 < 256) {
|
|||
|
form.segment2.value = "";
|
|||
|
form.segment3.value = "";
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
// Performs syntax check for loopback address
|
|||
|
if (loopcheck == 127) {
|
|||
|
// Confirms use of loopback for network address. If cancel, segment one is blanked
|
|||
|
if (!(confirm(loopbackmessage))) {
|
|||
|
form.segment1.value = "";
|
|||
|
form.segment2.value = "";
|
|||
|
form.segment3.value = "";
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (isNaN(newseg1)) {
|
|||
|
alert(numericmessage);
|
|||
|
newseg1 = parseInt(newseg1);
|
|||
|
if (isNaN(newseg1)) {
|
|||
|
form.segment1.value = "";
|
|||
|
} else {
|
|||
|
form.segment1.value = newseg1;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function checkData(form) {
|
|||
|
var newsegment1 = parseInt(form.segment1.value);
|
|||
|
var newsegment2 = parseInt(form.segment2.value);
|
|||
|
var newsegment3 = parseInt(form.segment3.value);
|
|||
|
|
|||
|
if (newsegment1 >= 128 && newsegment1 <= 191 && newsegment3 != 0) {
|
|||
|
alert(classbmessage1);
|
|||
|
form.segment3.value = 0;
|
|||
|
}
|
|||
|
|
|||
|
if ((newsegment1 < 128 && newsegment2 != 0) ||
|
|||
|
(newsegment1 < 128 && newsegment3 != 0)) {
|
|||
|
alert(classamessage);
|
|||
|
form.segment2.value=0;
|
|||
|
form.segment3.value=0;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function goback(formObj) {
|
|||
|
var newsegment1 = formObj.segment1.value;
|
|||
|
var newsegment2 = formObj.segment2.value;
|
|||
|
var newsegment3 = formObj.segment3.value;
|
|||
|
parent.hidden.data[1] = newsegment1;
|
|||
|
parent.hidden.data[2] = newsegment2;
|
|||
|
parent.hidden.data[3] = newsegment3;
|
|||
|
|
|||
|
|
|||
|
window.location="rzak1advsubwelcome.htm";
|
|||
|
}
|
|||
|
|
|||
|
function syntaxcheck(formObj) {
|
|||
|
var newsegment1=formObj.segment1.value;
|
|||
|
var newsegment2=formObj.segment2.value;
|
|||
|
var newsegment3=formObj.segment3.value;
|
|||
|
var good = 0;
|
|||
|
|
|||
|
// if all fields are blank
|
|||
|
if (newsegment1 == "" || newsegment2 == "" || newsegment3 == "") {
|
|||
|
alert(nonumeric2);
|
|||
|
} else {
|
|||
|
while (good == 0) {
|
|||
|
if (newsegment1 <= 1 || newsegment1 > 255) {
|
|||
|
alert(segment1message1);
|
|||
|
document.getipaddress.segment1.select();
|
|||
|
document.getipaddress.segment1.focus();
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment2 < 0 || newsegment2 > 255) {
|
|||
|
alert(segment2message1);
|
|||
|
document.getipaddress.segment2.select();
|
|||
|
document.getipaddress.segment2.focus();
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment3 < 0 || newsegment3 > 255) {
|
|||
|
alert(segment3message1);
|
|||
|
document.getipaddress.segment3.select();
|
|||
|
document.getipaddress.segment3.focus();
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment1 >= 128 && newsegment1 <= 191 && newsegment2 <= 0) {
|
|||
|
alert(classbmessage3);
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment1 >= 192 && newsegment2 <= 0) {
|
|||
|
alert (classcmessage1);
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment1 >= 192 && newsegment3 <= 0) {
|
|||
|
alert(classcmessage2);
|
|||
|
break;
|
|||
|
}
|
|||
|
if (isNaN(newsegment2)) {
|
|||
|
alert(nonumeric3);
|
|||
|
break;
|
|||
|
}
|
|||
|
if (isNaN(newsegment3)) {
|
|||
|
alert(nonumeric4);
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment1.indexOf(".") >= 0) {
|
|||
|
alert(numericmessage1);
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment2.indexOf(".") >= 0) {
|
|||
|
alert(numericmessage1);
|
|||
|
break;
|
|||
|
}
|
|||
|
if (newsegment3.indexOf(".") >= 0) {
|
|||
|
alert(numericmessage1);
|
|||
|
break;
|
|||
|
}
|
|||
|
|
|||
|
// Stores the form values into the container
|
|||
|
parent.hidden.data[1] = newsegment1;
|
|||
|
parent.hidden.data[2] = newsegment2;
|
|||
|
parent.hidden.data[3] = newsegment3;
|
|||
|
|
|||
|
//Call the sender function
|
|||
|
sender();
|
|||
|
|
|||
|
good = 1;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
//Obtain name of HTML file in parent frame.
|
|||
|
var parentDir = parent.window.location.href.substring(0,location.href.lastIndexOf('/')+1);
|
|||
|
var parentUrl = parent.window.location.href.substring(parentDir.length,parent.window.location.href.length+1);
|
|||
|
if (parentUrl.indexOf("#") >= 0) { parentUrl = parentUrl.substring(0,parentUrl.indexOf("#"));}
|
|||
|
|
|||
|
function checkFrame() {
|
|||
|
//Is the hidden frame already loaded with the correct html?
|
|||
|
if (parentUrl != "rzak1advsubwelcome.htm") {
|
|||
|
window.location = "rzak1advsubwelcome.htm"; //load calculatorframeset
|
|||
|
return;
|
|||
|
} else {
|
|||
|
//Obtain name of HTML file in hidden frame.
|
|||
|
var hiddenDir = parent.hidden.window.location.href.substring(0,location.href.lastIndexOf('/')+1);
|
|||
|
var hiddenUrl = parent.hidden.window.location.href.substring(hiddenDir.length,parent.hidden.window.location.href.length+1);
|
|||
|
if (hiddenUrl.indexOf("#") >= 0) { hiddenUrl = hiddenUrl.substring(0,hiddenUrl.indexOf("#"));}
|
|||
|
if (hiddenUrl != "rzak1advsubhidden.htm") {
|
|||
|
//Correct HTML not loaded, load it
|
|||
|
parent.hidden.window.location = "rzak1advsubhidden.htm";
|
|||
|
} else { //already loaded
|
|||
|
restorevalues();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
function restorevalues() {
|
|||
|
// This function restores previous values to the text fields. If the
|
|||
|
// first variable is blank, then nothing is restored
|
|||
|
|
|||
|
var restsegment1 = parent.hidden.data[1];
|
|||
|
var restsegment2 = parent.hidden.data[2];
|
|||
|
var restsegment3 = parent.hidden.data[3];
|
|||
|
|
|||
|
restsegment1 = parseInt(restsegment1);
|
|||
|
restsegment2 = parseInt(restsegment2);
|
|||
|
|
|||
|
if (!(isNaN(restsegment1))) {
|
|||
|
document.getipaddress.segment1.value = restsegment1;
|
|||
|
if (isNaN(restsegment2)) {
|
|||
|
restsegment2 = "";
|
|||
|
}
|
|||
|
document.getipaddress.segment2.value = restsegment2;
|
|||
|
if (isNaN(restsegment3)) {
|
|||
|
restsegment3 = "";
|
|||
|
}
|
|||
|
document.getipaddress.segment3.value = restsegment3;
|
|||
|
}
|
|||
|
}
|
|||
|
//END NON-TRANSLATABLE
|
|||
|
|
|||
|
//////////-->
|
|||
|
</script>
|
|||
|
|
|||
|
</HEAD>
|
|||
|
<BODY onload="checkFrame()">
|
|||
|
<h2>TCP/IP subnet calculator</h2>
|
|||
|
<STRONG>Enter your network address</STRONG>
|
|||
|
<noscript>
|
|||
|
<p>This calculator uses Javascript to function. Ensure you are using a browser which supports Javascript and that Javascript is enabled.</p></noscript>
|
|||
|
<p><label for="ipsegment">Enter the network address that you want to subnet. This calculator can subnet class A, class B,and class C addresses.</label></p>
|
|||
|
<p>Each segment of a valid network address must be between 0 and 255, and the first segment of any network
|
|||
|
address must be greater than 1.</p>
|
|||
|
<form name="getipaddress">
|
|||
|
<INPUT TYPE="text" SIZE=3 MAXLENGTH=3 NAME="segment1" id="ipsegment" onKeyUp="updateData(this.form)"> <strong>.</strong>
|
|||
|
<INPUT TYPE="text" SIZE=3 MAXLENGTH=3 NAME="segment2" id="ipsegment" onKeyUp="checkData(this.form)"> <strong>.</strong>
|
|||
|
<INPUT TYPE="text" SIZE=3 MAXLENGTH=3 NAME="segment3" id="ipsegment" onKeyUp="checkData(this.form)"> <strong>.</strong> 0
|
|||
|
<P><br><br><br>
|
|||
|
<center>
|
|||
|
<INPUT TYPE="button" VALUE="<< Back" onclick="goback(getipaddress)">
|
|||
|
<INPUT TYPE="button" VALUE= "Next >>" onclick="syntaxcheck(getipaddress)">
|
|||
|
</center>
|
|||
|
</form>
|
|||
|
|
|||
|
</BODY>
|
|||
|
</HTML>
|