Results 1 to 6 of 6

Thread: inserting script

  1. #1
    Join Date
    Aug 2010
    Location
    Kenley, Surrey
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default inserting script

    Hi Guys
    I'm trying to insert a script into a sidebar.js file for my website.
    The script shows basket quantity and subtotal.
    I can insert it into a html page and it works fine but does not work when i insert it into the sidebar.js. I would like the basket on the sidebar rather than on the page itself. You can see how I want it to look here www.pwauk.com/test2.htm

    This is the area i wish to insert the code.
    [CODE]//
    1ST NOTES AREA

    if (notes1 == "yes") {
    document.write('<fieldset><legend>');

    document.write('Your Shopping Basket<br></legend>');

    document.write('<div align="center"><img src="shopping_cart_2.gif" width="100" height="80"></div> <br><br> ');
    document.write('Basket Qty:<br><br>');
    document.write('Subtotal:<br><br>');
    document.write('<a href="http://www.romancart.com/cart.asp?storeid=25978">View Basket & Checkout</a>');
    document.write('</fieldset>');
    document.write('<br><br><br>');
    }
    [CODE]

    And the two lines i want to insert is
    [CODE]
    <SCRIPT LANGUAGE="JavaScript" SRC="http://www.romancart.com/cartinfo.asp?storeid=25978&type=1"></SCRIPT>
    <SCRIPT LANGUAGE="JavaScript" SRC="http://www.romancart.com/cartinfo.asp?storeid=25978&type=5"></SCRIPT>
    [CODE]

    Anyone got any ideas?
    Thanks
    Peter
    Sorry, I think I've posted this in the wrong section!
    Last edited by peteralexander; 08-21-2010 at 03:59 PM. Reason: wrong section

  2. #2
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    The code you're trying to insert calls the code it isn't the actually code which is what the js file would want put in

    var cText = '0'; document.write(cText);
    and

    var cText = '0.00'; document.write(cText);
    These seem to conflict and I don't think it will work as you want..
    Corrections to my coding/thoughts welcome.

  3. #3
    Join Date
    Aug 2010
    Location
    Kenley, Surrey
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your prompt reply.
    Are you saying I can't have these two scripts working in the sidebar?

    Sorry i'm clearly not up to speed on programming so its all trial and error! more error actually.

    If it won't work, I'll scrap the idea.

    Regards
    Peter

  4. #4
    Join Date
    May 2007
    Location
    Boston,ma
    Posts
    2,127
    Thanks
    173
    Thanked 207 Times in 205 Posts

    Default

    Your setting cText to 2 different values. I'm not sure which it should be cause I don't see where it is being used. I assume the first is for math functions and the second is for display purposes.
    Corrections to my coding/thoughts welcome.

  5. #5
    Join Date
    Aug 2010
    Location
    Kenley, Surrey
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    The first line of script is for how many items you put in the basket and the second line is the subtotal of items used in the basket.
    The amounts are automatically updated instantly once you add an item to basket and the info is called from the Romancart site.
    If you look at the page www.pwauk.com/test2.htm you can see it working on the page across the top and where i want it on the sidebar.

  6. #6
    Join Date
    Aug 2010
    Location
    Kenley, Surrey
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    No Worries, got it sorted by another method. Thanks for your help.
    Regards
    Peter

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •