Ask Experts Questions for FREE Help !
Ask
    boobiesonthetree's Avatar
    boobiesonthetree Posts: 2, Reputation: 1
    New Member
     
    #1

    Feb 15, 2008, 12:26 PM
    event handler function
    can somebody please please help me with this question I've been trying to do it for days and days and just can't get my head around it I know what I'm supposed to do but just don't know where to start this is the question and this is the code:-

    Clicking the button Add receipts to stock calls an event handler function that updates the arrays productStock and receivedLevels, by adding the receipts for each product to the value in productStock, and then setting the values receivedLevels to 0. The system should then display the new totals. Write this function.

    <HTML>
    <HEAD> M150 TMAO3 Question 3
    <TITLE>SOFASPEND - IN THE BEST POSSIBLE TASTE!</TITLE>

    <SCRIPT

    language="JavaScript"
    type="text/javascript">


    // These are arrays containing product data

    var productDescriptions = ['Superslurry electric blender', 'Apple - iPod (second-hand)',

    'CoziNap nylon duvet tog 2', 'Headbanger mini hi-fi 20W', 'MagiBoot shoe cleaning kit',

    'The PushmiPulu lawnmower'];

    var productPrices = [45, 50, 15, 25, 75, 7];

    var productStock = [200, 0, 2, 500, 50, 15];

    var receivedLevels = [50, 10, 150, 500, 50, 100];



    // Write the function showStockLevels() here

    function showStockLevels()
    /* display product stock in twelve text boxes */

    {
    document.administrator.ssMainStock.value='200';
    document.administrator.aiMainStock.value='0';
    document.administrator.cnMainStock.value='2';
    document.administrator.hbMainStock.value='500';
    document.administrator.mbMainStock.value='50';
    document.administrator.ppMainStock.value='15'
    document.administrator.ssReceivedStock.value='50'
    document.administrator.aiReceivedStock.value='10'
    document.administrator.cnReceivedStock.value='150'
    document.administrator.hbReceivedStock.value='500'
    document.administrator.mbReceivedStock.value='50'
    document.administrator.ppReceivedStock.value='100'
    };

    // Write the function addAllReceivedItems() here



    // Write the function calculateTotals() here



    </SCRIPT>

    </HEAD>

    <BODY>

    <FORM NAME = "administrator">
    <BR>
    SOFA SPEND plc. CURRENT STOCK LEVELS<BR><BR>
    Superslurry electric blenders <BR> Current stock
    <BR>
    <INPUT TYPE = "text"
    NAME = "ssMainStock"
    VALUE = "" >
    Received:
    <INPUT TYPE = " >
    Received:
    <INPUT TYPE = "
    NAME = "ssReceivedStock"
    NAME = "">
    <BR><BR>
    Apple iPods (second hand) <BR> Current stock
    <BR>
    <INPUT TYPE = "
    VALUE = "
    NAME = "aiMainStock">
    <BR><BR>
    Apple iPods (second hand) <BR> Current stock
    <BR>
    <INPUT TYPE = "" >
    Received:
    <INPUT TYPE = "
    NAME = "
    NAME = "aiReceivedStock"
    VALUE = "">
    <BR><BR>
    CoziNap duvets<BR> Current stock
    <BR>
    <INPUT TYPE = " >
    Received:
    <INPUT TYPE = "
    NAME = "cnMainStock"
    NAME = "" >
    Received:
    <INPUT TYPE = "
    VALUE = "
    NAME = "cnReceivedStock">
    <BR><BR>
    CoziNap duvets<BR> Current stock
    <BR>
    <INPUT TYPE = "">
    <BR><BR>
    Headbanger hi-fi<BR> Current stock
    <BR>
    <INPUT TYPE = "
    NAME = "
    NAME = "hbMainStock"
    VALUE = "" >
    Received:
    <INPUT TYPE = " >
    Received:
    <INPUT TYPE = "
    NAME = "hbReceivedStock"
    NAME = "">
    <BR><BR>
    Magiboot cleaning kits<BR> Current stock
    <BR>
    <INPUT TYPE = "
    VALUE = "
    NAME = "mbMainStock">
    <BR><BR>
    Headbanger hi-fi<BR> Current stock
    <BR>
    <INPUT TYPE = "" >
    Received:
    <INPUT TYPE = "
    NAME = "
    NAME = "mbReceivedStock"
    VALUE = "">
    <BR><BR>
    PushmiPulu lawnmowers<BR> Current stock
    <BR>
    <INPUT TYPE = " >
    Received:
    <INPUT TYPE = "
    NAME = "ppMainStock"
    NAME = "" >
    Received:
    <INPUT TYPE = "
    VALUE = "
    NAME = "ppReceivedStock">
    <BR><BR>
    Magiboot cleaning kits<BR> Current stock
    <BR>
    <INPUT TYPE = ""
    NAME = "button"
    VALUE = "Show all stock holdings" >
    Received:
    <INPUT TYPE = "showStockLevels()"
    NAME = "button"
    VALUE = "Add receipts to stock">
    <BR><BR>
    PushmiPulu lawnmowers<BR> Current stock
    <BR>
    <INPUT TYPE = "addAllReceivedItems()"
    NAME = "statistics"
    VALUE = "mainStock" >
    Received:
    <INPUT TYPE = "TYPE = "
    NAME = "
    VALUE = '' >
    <BR>
    Total received stock items<BR>
    <INPUT NAME = "receivedStock"
    VALUE = "TYPE = ">
    <BR><BR>
    <INPUT TYPE = "
    VALUE = '' >
    <BR>
    Total number stock items --- Total value of stock ------- Total tax payable<BR>
    <INPUT NAME = "allStock"
    VALUE = "TYPE = "
    ONCLICK = "
    VALUE = '' >
    <INPUT NAME = "allStockValue">

    <INPUT TYPE = "TYPE = "
    VALUE = "
    VALUE = '' >
    <INPUT NAME = "allTax"
    ONCLICK = "TYPE = ">
    <BR><BR>

    </FORM>

    <FORM NAME = "
    VALUE = '' >
    <BR><BR>
    Press button to calculate...
    <INPUT TYPE = "button">
    Total main stock items<BR>
    <INPUT NAME = "Calculate totals"
    "calculateTotals()">
    </FORM>

    </BODY>

    </HTML>

Check out some similar questions!

Your thoughts on this event? [ 21 Answers ]

Tuesday night, I went to invite my 15yo daughter to rent a video or two and found her asleep. I returned to the living room as I was very tired due to short night Monday. I was set up to sleep on the futon/bed in the living room as it is cooler there and fell asleep around 8:30pm. Some time after...

Can't remember event [ 8 Answers ]

Hi, I am a 17 year old female. To ask this question I will first provide some background information. Tonight, at a party my father told the guests of a story that I had told him. He said to me "Grace, tell them about the time the man came into your shop to buy knifes to protect himself in the...

Event management [ 1 Answers ]

I'm looking for the job in event mangment companies, pz give me information about the companies & vaccancies

Special Event [ 1 Answers ]

I have a very important event coming up on April 29th of this year. I would like to lose twenty pounds by that time. I don't think that's too much weight to lose in this time, but it seems so hard to lose weight. Does anybody have any ideas on how I can lose 20 lbs in 2 1/2 months?

Customer Event [ 1 Answers ]

Hi there Want to organise a customer event for top customers and their wives. Should be a lovely evening and I do want to put it under the moto: a different perspective for a bigger picture. Any idea what could be a special event around that? Was thinking of maybe going to an observatory and...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.