1. DroidForums.net is currently undergoing a major software upgrade. If you are experiencing any problems logging in please: Contact Us

Need help from someone more experienced than me....

Discussion in 'Off Topic Forum' started by droidxd00d, Oct 18, 2012.

  1. droidxd00d
    Offline

    droidxd00d New Member

    Joined:
    Oct 7, 2011
    Messages:
    244
    Likes Received:
    8
    Trophy Points:
    0
    Hey guys I have a problem from school. It is a html/javascript homework that I have been struggling with since I am still pretty new at this. I'm not asking for anyone to do the whole project for me I just would appreciate any advice, tips, or bits of code!

    Hey guys I have a problem from school

    "For this assignment, your task is to modify Assignment #1 to fix your errors, use loops, use functions, use an external style sheet and add images to your page.

    In order to fill the array that stores the “Percentage of the semester completed” information, you will call a function. This function will use a loop to fill the array.

    In order to write the table onto the Web page, you will call a function that will use a loop to create and fill the table. Each of the values of column 3 should be calculated by calling another function.

    You will create an external style sheet, which will add formatting to your page. At a minimum, your style sheet should include code to change the background color of the page and change the color of the font used for the text defined by the table heading and table data tags.

    Finally, you will add an appropriate image to your page. This image should change to another image at periodic intervals (similar to the image in the Pine Knoll Properties page that we created in class)."

    I got most of it but I can't figure out a solution for stepping through the two arrays I have and then writing them to the table. Any help would be appreciated! Oh also how do I center align the table?

    now for the mess of code...

    {code}
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head>
    <title>Tuition Refund Document</title>
    <meta http-equiv="content-type" content="text/html;charset=iso-8859-1" />
    <link rel="stylesheet" href="refund_styles.css" type="text/css" />

    </head>
    <body onload="var changeImages=setInterval('homepageAd()',2000);">
    <h1>Refund of Tuition and Fees for Students Who Drop or Withdrawal from Classes</h1>
    <h2>A single three credit class costs <font face="Arial" color="red">$804</font><p align="center"><img src="calU.jpg" height="100" width ="400" /></h2>
    <script type="text/javascript">

    var classCost=804;

    var semesterPercentage = new Array();
    semesterPercentage[0] = "Through Week 1";
    semesterPercentage[1] = "Through Week 2";
    semesterPercentage[2] = "Through Week 3";
    semesterPercentage[3] = "Through Week 4";
    semesterPercentage[4] = "Through Week 5";
    semesterPercentage[5] = "Through End of Semester";

    var refundPercentage = new Array();
    refundPercentage[0] = 1;
    refundPercentage[1] = .8;
    refundPercentage[2] = .6;
    refundPercentage[3] = .5;
    refundPercentage[4] = .4;
    refundPercentage[5] = 0;



    var curImage = "calU";
    var changeImages;
    function homepageAd() {
    if (curImage == "money1") {
    document.images[0].src = "calU.jpg";
    curImage == "calU";
    }
    else {
    document.images[0].src = "money1.jpg";
    curImage = "money1";
    }
    }


    function fillArray() {





    function calculateRow(currentRow)
    {
    var i = currentRow;
    var rowValue = (refundPercentage[i+1] * classCost);
    return rowValue;
    }

    function displayRow()
    {
    document.write(calculateRow() + "is the price" );

    }








    do
    {
    document.write("<tr><td>" + semesterPercentage[increment] + "</tr><td>%" + calculatePercent(increment) +
    "</tr><td>$ " + calculateRow(increment) + "</tr>");
    increment++
    }
    while (increment < 6 )
    }


    document.write("<table border='1' width='50%'><colgroup span='3' width='30%' /><colgroup span='5' width='14%' /><tr><th>Percentage of the Semester Completed</th> <th>Refund Percentage</th><th>Amount of Refund Per 3 Credit Class</th></tr>");




    </script>
    </body>
    </html>


    {code}

    the table is supposed to look like this View attachment 57274
  2. lloydstrans
    Offline

    lloydstrans Well-Known Member

    Joined:
    Nov 16, 2011
    Messages:
    9,747
    Likes Received:
    70
    Trophy Points:
    48
    Not too much luck with your request, sorry. I tried to learn this stuff years ago and figured someone else would create a better way, so i gave up.

    Good luck.