This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This is a comment --> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title> Hello World </title> | |
</head> | |
<body> | |
<h1> This is a Large Heading </h1> | |
<h2> This is a Medium Heading </h2> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--********************************************************* | |
* Converts from binary to decimal (and vice versa). | |
* Note: uses Bootstrap for the "well" class. | |
* Copy-paste this code below into your HTML file. | |
* This code will generate the user interface. | |
********************************************************** | |
--> | |
<!-- Start of yellow-green container --> | |
<div class="well" style="background-color:#99FF00"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************* | |
* Responds to the "Convert!" button click. | |
* (This could be thought of as the "main" function). | |
* Step 1: Validates the text field input. | |
* Step 2: Determines which conversion to perform. | |
* Step 3: Performs the appropriate calculation. | |
* Step 4: Displays the result on the web page. | |
********************************************************/ | |
function buttonClick() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************* | |
* Removes space characters from the input string. | |
* @param {String} inputString | |
* @return {String} "cleaned up" inputString. | |
*********************************************************/ | |
function removeSpaces( inputString ) { | |
// If the inputString is empty, return an error. | |
if (!inputString) return "Error"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************* | |
* Checks whether a given string represents a number of | |
* the given base. For example, 1101 is base 2. | |
* @param {String} digitString | |
* @param {String} base | |
* @return {Boolean} true if digitString matches base | |
********************************************************/ | |
function validateInput( digitString, base ) { | |
// Determine the cardinality of the digitSet. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************* | |
* Displays an output message on the webpage. | |
* @param {String} message to display | |
********************************************************/ | |
function displayResult( message ) { | |
var resultArea = document.getElementById("resultArea"); | |
var content = ("<h4><em>" + message + "</em></h4>"); | |
resultArea.innerHTML = content; | |
esultArea.style.display = "block"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************* | |
* Converts a positive integer from binary to decimal. | |
* @param {Number} binaryNumber (e.g. 1101) | |
* @return {Number} decimalNumber (e.g. 13) | |
********************************************************/ | |
function binaryToDecimal( binaryNumber ) { | |
// decimalNumber represents a summation of digit values. | |
var decimalNumber = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/********************************************************* | |
* Converts a positive integer from decimal to binary. | |
* @param {Number} decimalNumber (e.g. 5) | |
* @return {Number} binaryNumber (e.g. 101) | |
********************************************************/ | |
function decimalToBinary( decimalNumber ) { | |
// binaryNumber represents a summation of digit values. | |
var binaryNumber = 0; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- Reference a JavaScript file in the same directory. --> | |
<script src="functions.js"></script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!--****************************************************** | |
* BaseConvert.html | |
* Created by Karlina Beringer | |
* Updated October 17, 2014 | |
* Converts between multiple numerical bases, | |
* namely bases two through sixteen. | |
****************************************************** | |
--> | |
<!DOCTYPE HTML> | |
<html> |
OlderNewer