Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Apr 2005
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    what does += mean?

    Hey all,

    What does the != in the follwing function mean.
    Code:
    if (item_id != ' ') {

    And the += and &on0= and escape in this one?
    Code:
     cartUrl += '&on0=' + escape("Size");


    Here is the entire function
    Code:
    function addToCart (qty,item_id,name,price,size,color,shipping,shipping2) {
       var cartUrl = paypal_url 
            + 'add=1'
            + '&business=' + escape(business)
            + '&currency_code=' + escape(currencyCode)
            + '&amount=' + escape(price);
      if (item_id != '') { 
        cartUrl += '&item_number=' + escape(item_id);
      }
      if (name != '') {
        cartUrl += '&item_name=' + escape(name);
      }
      if (size != '') {
        cartUrl += '&on0=' + escape("Size");
        cartUrl += '&os0=' + escape(size);
      }
      if (color != '') {
        cartUrl += '&on1=' + escape("Color");
        cartUrl += '&os1=' + escape(color);
      }
      if (qty != '' && qty != 0) {
        cartUrl += '&quantity=' + escape(qty);
        cartUrl += '&undefined_quantity=1';
      }
      if (shipping != '') {
        cartUrl += '&shipping=' + escape(shipping);
      }
      if (shipping2 != '') {
        cartUrl += '&shipping2=' + escape(shipping2);
      }
      openCartWin(cartUrl);
    }
    If you know one or any of these please reply. Thanks

    Echo

  • #2
    Master Coder
    Join Date
    Feb 2003
    Location
    Umeå, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    expr1 != expr2 means "if expr1 is not equal to expr2 return true, otherwise return false".

    id += expr is equal to id = id + expr and means "assign id the value of adding id and expr together"


    '&on0=' is a simple string, nothing strange with that.


    escape is a function that escapes characters that have special meaning in URLs to '%nn' sequences.
    Last edited by liorean; 04-12-2005 at 12:27 AM.
    liorean <[lio@wg]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #3
    Super Moderator sage45's Avatar
    Join Date
    May 2002
    Posts
    1,059
    Thanks
    0
    Thanked 13 Times in 13 Posts
    The '!=' is used to signify 'not equal to'

    The '+=' means add whatever is after the equal sign to whatever is in front of the plus sign and assign back the the variable in front of the plus sign.

    -sage-

    Edited: NOOOOOOOOO!!! Beaten to the punch by liorean... Darn you liorean!!!!!!!! But yeah what he said too...
    Last edited by sage45; 04-12-2005 at 12:28 AM.
    HTML & CSS Forum Moderator

    "If you don't know what you think you know, then what do you know."
    R.I.P. Derrick Thomas #58
    1/1/1967 - 2/8/2000


  •  

    Posting Permissions

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