Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    i keep getting the javascript error object expected when i try to click the buttons add labour and add item can anyone figure out what the problum may be?
    thanks

    Note:
    the other buttons will not function as thay are not yet scripted
    Thee Pyro Wolf

  2.  

  3. #2
    Junior Member
    Join Date
    Feb 2006
    Posts
    12
    Member #
    12651
    missing ; after for-loop initializer

    complete.html (line 63)

    for(var a = 0a<items.lengtha +=3)

  4. #3
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    Quote Originally Posted by cheatdeath
    missing ; after for-loop initializer

    complete.html (line 63)

    for(var a = 0a<items.lengtha +=3)
    thanks, i was useing a browser that didn't detect that error. and i don't exactly know how i missed it myself. However i am still getting the same error and i still don't exactly know what is causeing it
    I edited the post to reflect the change needed to be made for the for loop
    Thee Pyro Wolf

  5. #4
    Junior Member
    Join Date
    Feb 2006
    Posts
    12
    Member #
    12651
    missing ; after for-loop initializer

    complete.html (line 71)

    for(var b = 0b<items.lengthb +=3)

  6. #5
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    yeah i got all those lol here is the code as i have it now.
    HTML Code:
    <?xml version="1.0"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>Garage service - Pyro Design</title>
        <script language="javascript"
              type="text/javascript">
        //<![CDATA[
        var parts = new Array()
        var labour = 0
        var ic = 0
        var hoursW = new Array()
        var items = new Array()
        var pst = 0
        var gst = 0
        var gstRate = 6
        var pstRate = 8 //applys to services only
        var labourRate = 65
        var hpos = 0
        var ipos = 0
        var maxL = new Array()
        maxL[0] = 7
        maxL[1] = 15
        maxL[2] = 7
        maxL[3] = 0
        //now = new Date()
        function AS()
        {
        var desca = document.invoice.lDesc.value
        var hw = parseInt(document.invoice.llength.value)
        hoursW[hpos] = desca
        hoursW[hpos + 1] = hw
        hoursW[hpos + 2] = hw * 65
        labour = labour + (hw * 65)
        if(code.length > maxL[2])
            maxL[2] = description.length
        if(desca.length > maxL[3])
            maxL[3] = hw.length
    
        ipos = ipos + 3
        }
    
        function AI()
        {
        var code = document.invoice.icode.value
        var desc = document.invoice.iDesc.value
        var cost = parseInt(document.invoice.icost.value)
        if(code.length > maxL[0])
            maxL[0] = code.length
        if(desc.length > maxL[1])
            maxL[1] = description.length
        items[ipos] = code
        items[ipos + 1] = description
        items[ipos + 2] = cost
        ic += cost
        ipos += 3
        }
        function checkout()
        {
        var recipt = document.invoice.recipt
        recipt.value = "Red Nek Recreation\n\n"
        //recipt.value += "Date:" now.toGMTString() + '\n'
        recipt.value += "Items purchased:" + '\n'
        recipt.value += "---------------------\n"
        recipt.value += "id" + spacer(0) + "item" + spacer(1) + "Cost\n"
        recipt.value += "---------------------\n"
        for(var a = 0;a<items.length;a+=3)
        {
        recipt.value += items[a] + spacer(0) + items[a + 1] + spacer( 1 ) + items[ a + 3 ] + '\n' 
        }
        //laboursetup
        recipt.value += "---------------------\n\n"
        recipt.value += "desc" + spacer(2) + "time" + spacer(3) + "Cost\n" 
        recipt.value += "---------------------\n" 
        for(var b=0;b <items.length;b + = 3;)
        {
        recipt.value += ha[b] + spacer(2) + ha[b+1] + spacer(3) + ha[b+3] + '\n'
        }
        recipt.value= "\nLabour:  $" + labour;
        recipt.value= "\nParts: $" + ic + '\n'
        gst= ((labour + ic) \ 100) * gstRate 
        pst= (ic\100) * pstRate 
        recipt.value="GST: $" + gst + '\n'
        recipt.value="PST: $" + pst + '\n'
        var total= gst + pst + ic + labour 
        recipt.value += "TOTAL $" + total + '\n'
        recipt.value += "\n\n PROVIDED BY PYRODESIGN>>&copy"
        }
        function spacer(item)
        {
        var sp=' '
        for(var cc = 1;cc < maxL[item]+5;c++;)
        {
        sp += ' '
        }
        return sp;
        }
        //]]>
        </script>
        <style type="text/css">
        /*<![CDATA[*/
        td.c2 {vertical-align:top}
        input.c1 {text-align:right}
        /*]]>*/
        </style>
    </head>
    
    <body>
        <h1>Red Nek Recreation</h1>
    
        <form name="invoice">
            <table>
                <tr>
                    <td class="c2">
                        <fieldset id="labour">
                            <legend>Labour:</legend> 
    
                            <table>
                                <tr>
                                    <th>Labour Description:</th>
    
                                    <td><input type="text"
                                           name="lDesc"
                                           value="General Labour" /></td>
                                </tr>
    
                                <tr>
                                    <th>time:</th>
    
                                    <td><input type="text"
                                           name="llength"
                                           value="0.00"
                                           size="6"
                                           class="c1" /></td>
                                </tr>
    
                                <tr>
                                    <td><button type="button"
                                            onclick="AS()">Add
                                            Labour</button></td>
    
                                    <td><button type="button"
                                            onclick="cL()">Clear
                                            fields</button></td>
                                </tr>
                            </table>
                        </fieldset>
    
                        <fieldset id="items">
                            <legend>Items:</legend> 
    
                            <table>
                                <tr>
                                    <th>Item id</th>
    
                                    <td><input type="text"
                                           name="icode"
                                           value="00-0000"
                                           size="8" /></td>
                                </tr>
    
                                <tr>
                                    <th>Item Description</th>
    
                                    <td><input type="text"
                                           name="iDesc"
                                           value="Stock Item" /></td>
                                </tr>
    
                                <tr>
                                    <th>Item cost</th>
    
                                    <td>$<input type="text"
                                           name="ldesc"
                                           value="0.00"
                                           size="6"
                                           class="c1" /></td>
                                </tr>
    
                                <tr>
                                    <td><button type="button"
                                            onclick="AI()">Add
                                            Item</button></td>
    
                                    <td><button type="button"
                                            onclick="clearItem()">Clear
                                            fields</button></td>
                                </tr>
                            </table>
                        </fieldset><button type="button"
                            onclick="checkout()">Finish
                            invoice</button> <button type="reset"
                            onclick="resetVars()">Reset
                            Variables</button>
                    </td>
    
                    <td>
                    <textarea rows="30"
                              cols="30">
    Red Nek Recreation
                    </textarea></td>
                </tr>
            </table>
        </form>
    </body>
    </html>
    Thee Pyro Wolf

  7. #6
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    There's a [minicode]b + = 3[/minicode] that needs to be a [minicode]b += 3[/minicode] and an extra semicolon on the [minicode]cc[/minicode] incrementor. Use Firefox to debug Javascript, it gives error messages that actually make sense.

  8. #7
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    Quote Originally Posted by Shadowfiend
    There's a [minicode]b + = 3[/minicode] that needs to be a [minicode]b += 3[/minicode] and an extra semicolon on the [minicode]cc[/minicode] incrementor. Use Firefox to debug Javascript, it gives error messages that actually make sense.
    yeah i know what you mean however i have not had that available to me. Personally internet Explorer is not what one shoulc call a browser. Thanks a bunch
    Thee Pyro Wolf

  9. #8
    Senior Member filburt1's Avatar
    Join Date
    Jul 2002
    Location
    Maryland, US
    Posts
    11,774
    Member #
    3
    Liked
    21 times
    Quote Originally Posted by Shadowfiend
    There's a [minicode]b + = 3[/minicode] that needs to be a [minicode]b += 3[/minicode] and an extra semicolon on the [minicode]cc[/minicode] incrementor. Use Firefox to debug Javascript, it gives error messages that actually make sense.
    +1. IE gives the most absolutely worthless Javascript error messages; it might as well pop up a blank messagebox. Firefox's Javascript console is far, far more useful, but then you're testing your code on Firefox when the problem you're fixing might be IE-specific.
    filburt1, Web Design Forums.net founder
    Site of the Month contest: submit your site or vote for the winner!

  10. #9
    Senior Member
    Join Date
    Jun 2005
    Location
    Atlanta, GA
    Posts
    4,146
    Member #
    10263
    Liked
    1 times
    Still, though, you can eliminate about 95% of bugs cross-browser with Firefox, and then deal with the ones that are IE-specific when the time comes, and deal with on 5 instead of 100 :-) You still lose a couple of days on it, though. Less as you get more used to the usual idiocies IE brings up.

  11. #10
    Senior Member
    Join Date
    Feb 2005
    Location
    Canada
    Posts
    435
    Member #
    8983
    Quote Originally Posted by filburt1
    +1. IE gives the most absolutely worthless Javascript error messages; it might as well pop up a blank messagebox. Firefox's Javascript console is far, far more useful, but then you're testing your code on Firefox when the problem you're fixing might be IE-specific.
    true this is, however alot of the errors are both browsers depending on the code. It would be nice to have a javascript console plug in for IE however i can't see explorer imporveing any
    Thee Pyro Wolf


Page 1 of 2 1 2 LastLast

Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 11:10 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com