<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/jquery.validate.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/additional-methods.min.js"></script> <style> .error { color: red; padding-left: 5px; } </style> <form id="TextExampleDOMForm" onsubmit="return false"> <input type="submit" value="SubmitExample" Name="SubmitButton" onclick="TextExample()"> <label for="txtName">Name: </label> <input type="text" id="txtName" name="txtName" size="20" maxlength="20" data-rule-required="true" data-msg-required="Name is Required" > <label for="txtName" class="error"></label> <label id="SubmitExampleValue"></label> <script> function TextExample() { document.getElementById("SubmitExampleValue").innerHTML = document.getElementById("txtName").value; } $( "#TextExampleDOMForm" ).validate({ }); </script> </form>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/jquery.validate.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/additional-methods.min.js"></script> <style> .error { color: red; padding-left: 5px; } </style> <form id="SelectExampleDOMForm" onsubmit="return false"> <input type="submit" value="SelectExample" name="SelectButton" onclick="SelectExample()"> <label>Auto: </label> <select name="selAuto" id="Auto" data-rule-required="true" data-msg-required="Auto is Required"> <option value="">Select an Auto...</option> <option value="Volvo">Volvo (Latin for 'I roll')</option> <option value="Saab">Saab (Swedish Aeroplane AB)</option> <option value="Mercedes">Mercedes (Mercedes-Benz)</option> <option value="Audi">Audi (Auto Union Deutschland Ingolstadt)</option> </select> <label for="selAuto" class="error"></label> <span id="SelectExampleValue"></span> <script> function SelectExample() { document.getElementById("SelectExampleValue").innerHTML = document.getElementById("selAuto").value; } $( "#SelectExampleDOMForm" ).validate({ }); </script> </form>
onsubmit="return false"
in the <form> tag.if ($(#myform).valid()) {
<input type="submit" formnovalidate name="cancel" value="Cancel">
document.getElementByID("myText").value
to get/set the value in an input field, such as <input type = "text" id="myText">
document.getElementByID("myText").innerHTML
to get/set the value of HTML elements, such as <div id = "myText">
document.getElementById("myImage").src = "landscape.jpg";
document.getElementByID("myText").style.color = "blue";
Assignment - Due in February 9 - for a circle with a given Radius, you can make the following calculations:
Create a javascript program that
Create a project called Circle and put your solution in index.html. Here's a starter file.
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/jquery.validate.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/jquery-validation@1.19.1/dist/additional-methods.min.js"></script> <style> .error { color: red; padding-left: 5px; } </style> <form id="RadioExampleValidationCheckForm" onsubmit="return false"> <input type="submit" value="RadioExample" name="RadioButton" onclick="RadioExample()"> <label>Cars: </label> <label for="rdChevrolet"><input type="radio" id="rdChevrolet" name="rdcar" value="Chevrolet" data-rule-required="true" data-msg-required="Car is Required" />Chevrolet</label> <label for="rdFord"><input type="radio" id="rdFord" name="rdcar" value="Ford" />Ford Motor</label> <label for="rdDodge"><input type="radio" id="rdDodge" name="rdcar" value="Dodge" />Dodge Ram</label> <label for="rdcar" class="error"></label> <span id="RadioExampleValue"></span> <br> </form> <script> function RadioExample() { if (document.getElementById("rdChevrolet").checked) { document.getElementById("RadioExampleValue").innerHTML = document.getElementById("rdChevrolet").value; } if (document.getElementById("rdFord").checked) { document.getElementById("RadioExampleValue").innerHTML = document.getElementById("rdFord").value; } if (document.getElementById("rdDodge").checked) { document.getElementById("RadioExampleValue").innerHTML = document.getElementById("rdDodge").value; } } $( "#RadioExampleValidationCheckForm" ).validate({ }); </script>
<input type="submit" value="CheckboxExample" name="CheckboxButton" onclick="CheckboxExample()"> <label>Fruits: </label> <label for="ckApple"> <input type="checkbox" name="ckfruit1" id="ckApple" value="Apple">Red Apple</label> <label for="ckPear"> <input type="checkbox" name="ckfruit2" id="ckPear" value="Pear">Green Pear</label> <label for="ckBanana"> <input type="checkbox" name="ckfruit3" id="ckBanana" value="Banana">Yellow Banana</label> <span id="CheckBoxExampleAppleValue"></span> <span id="CheckboxExamplePearValue"></span> <span id="CheckBoxExampleBananaValue"></span> <script> function CheckboxExample() { document.getElementById("CheckBoxExampleAppleValue").innerHTML = ""; document.getElementById("CheckboxExamplePearValue").innerHTML = ""; document.getElementById("CheckBoxExampleBananaValue").innerHTML = ""; if (document.getElementById("ckApple").checked) { document.getElementById("CheckBoxExampleAppleValue").innerHTML = document.getElementById("ckApple").value; } if (document.getElementById("ckPear").checked) { document.getElementById("CheckboxExamplePearValue").innerHTML = document.getElementById("ckPear").value; } if (document.getElementById("ckBanana").checked) { document.getElementById("CheckBoxExampleBananaValue").innerHTML = document.getElementById("ckBanana").value; } } </script>
Assignment - Due February 15 - Create a new project called Calculator. As closely as possible, create the web form shown the image below in your workspace. When complete, you should be a calculator that let's you add, subrtract, multiply, and divide two numbers. The operands are required and should be numeric floating point. Display error messages as appropriate. The clear button should clear all inputs, error messages and results. Hint: Make a copy of the MinMaxAvg project and get it to work in your workspace, then modify it for this assignment.
Assignment - Due February 20 at midnight - Create a new project called unitsconversion. Create index.html, and an assets, script, and style subfolders. As closely as possible, create the web form using the image below. When complete, you should prompt for a numeric value, the value's units (call "FromUnits") and the units to convert the value to (called "ToUnits"). When the calculate button is pressed you will make an AJAX call to a webpage that will do the conversions for you. The value is required and should be numeric. The FromUnit and ToUnit are required. Display error messages as appropriate. The clear button shold clear all inputs, error messages and results.
To see the operation of the webpage, try: Example of Calculation - Converts 10 cm to in (3.937007874 in)
Here is the simplest code to chart dates and values:
var ctx = document.getElementById("chartjs-0"); var myChart = new Chart(ctx, { "type":"line", "data": { "labels": dates, "datasets":[{ "data": values, fill: false }] }, "options":{ responsive: false, maintainAspectRatio: true, } });
Assignment - Due March 7 - Review the documentation for Currency Value Conversion, known as FOREX, located at https://polygon.io/docs/forex/getting-started. You will need to signup for an api token. You can see all the currency symbols at http://eoddata.com/stocklist/FOREX.htm.
Create a project called Currency Value History. As closely as possible, create the web form using the images below. Your application should let the user select at least 5 currencies (including US Dollars) to convert from and to. You should also prompt for from and to dates. The application should construct a URL and make an AJAX call to the Polygon.io Forex data. You should use chart.js to graph the data. All of the input data is required. Display error messages as appropriate. The clear button should clear all inputs, error messages and results.
Assignment - Due March 14 - Review the documentation for Mars Rover Photo Database, located at https://api.nasa.gov. Review the limitations on the number of requests you can use with the DEMO api key.
Create a new project called Mars Rover Photo Explorer. As closely as possible, create the web form using the images below. Your application has the following requirements:
for (i = 0; i < 25; i++) { // Note how we construct the name for image1, image2, etc...this sets the image source document.getElementById("image" + i).src = msg.photos[i].img_src; do something to set the tool tip = msg.photos[i].camera.full_name; }
ProjectManagementDocs.com provides a excellent set of document templates for managing a large projects.
Review the Work Breakdown Structure (WBS), which can be found on ProjectManagementDocs.com at:
Example Project Management Documents
Get Started with the WBS
One of the best ways of project planning involves developing a kanban (billboard in Japanese) for all of the requirements in the project. Using two colors of post-it notes and a white board to map out what needs to be done, when and by whom. Simple, but effective.
The kanban process should run something like this:
In preparation for the meeting with your client, review the following project management documents at ProjectManagementDocs.com:
Review the following materials:
www.trello.com is a freemium, web-based ect management tool that allows you to take your Work Breakdown Structure and interactively schedule your project. All enterprise project management system, including Microsoft Project, Primavera, and others use the same techniques found in Trello.
Navigate to https://www.trello.com and create an account
In your HTML document, add the following for the chart: <canvas id="chartjs-0" width="400" height="400"></canvas> In your javascript after the msg has been returned from the AJAX call, add the following: /* Site 1 */ var dates = []; var values = []; /* fLen contains the length of the array (number of values) */ fLen = msg.value.timeSeries[0].values[0].value.length for (i = 0; i < fLen; i++) { values[i] = msg.value.timeSeries[0].values[0].value[i].value dates[i] = msg.value.timeSeries[0].values[0].value[i].dateTime } var sitename = msg.value.timeSeries[0].sourceInfo.siteName var sitecode = msg.value.timeSeries[0].sourceInfo.siteCode[0].value var siteDescription = msg.value.timeSeries[0].variable.variableDescription /* Put your code here to display a graph of values and dates for Site 1*/ /* Site 2 */ var dates = []; var values = []; /* fLen contains the length of the array (number of values) */ fLen = msg.value.timeSeries[1].values[0].value.length for (i = 0; i < fLen; i++) { values[i] = msg.value.timeSeries[1].values[0].value[i].value dates[i] = msg.value.timeSeries[1].values[0].value[i].dateTime } var sitename = msg.value.timeSeries[1].sourceInfo.siteName var sitecode = msg.value.timeSeries[1].sourceInfo.siteCode[0].value var siteDescription = msg.value.timeSeries[1].variable.variableDescription /* Put your code here to display a graph of values and dates */ /* Continue for Sites 3 and 4 */