Purchase Solution

Use HTML and JavaScript to display table from input

Not what you're looking for?

Ask Custom Question

I did most of the homework part. I need someone to help me to fix it (see attachment for requirements)

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
document.write("Please Enter items purchased with price of each<br/> Item: Price, Item: Price<br/><br/>");
document.write("Ex:Bread:2, Milk:7,rice:90 ");

function split()
{
var inputval=document.getElementById("textarea").value;
var nameArray=inputval.split(":");
var nameArray=inputval.split(",");

for(i=0;i<nameArray.length;i++)

document.write(nameArray[i]+"<br/>");
document.getElementById("txtarea").value=nameArray.join("n");

document.write("<table border=1><tr><td>"+i+"</td><td>"+integer[i]+"</td></tr>");
document.writeln("<table border=1><tr><td>Item</td><td>Price</td></tr>");
document.write("</table>");

}

</script>
<body>
<form id="splitform" action="">

<textarea id="txtarea"rows="13" cols="36"></textarea></p>
<input type="button" id="buttonsplit" onclick="split()" value="Organize!"/ ></p>

</body>
<head>
<html>

Purchase this Solution

Solution Summary

Make a page with HTML and JavaScript that parses user input in a specified format and makes a table of the results. The table will have two columns, one for item and one for price. The final row will display the total price.

Solution Preview

First I cleaned up some erroneous tags (stray p tags and a head tag, etc.). Then I moved the two initial document.write() lines out of the JavaScript and just put them in the HTML since they are static text. Also, I ...

Purchase this Solution


Free BrainMass Quizzes
Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.

Word 2010: Tables

Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.

Word 2010: Table of Contents

Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.

Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

C++ Operators

This quiz tests a student's knowledge about C++ operators.