Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   <script>
  2. function changePrice(obj) {
  3.   var attrValue = obj.val();
  4.   var attrCheckbox = $("input[name=insurance]", ".jq-checkbox").attr("checked");
  5.  
  6.   if (attrValue == 'vk_community' && attrCheckbox == true) {price = <? echo $config_extra['default_price_vk_community_insurance']; ?>;}
  7.  
  8.   if (attrValue == 'vk_community' && attrCheckbox != true) {price = <? echo $user['price_adv_vk_community'] != '0' ? $user['price_adv_vk_community'] : $config_extra['default_price_vk_community']; ?>;}
  9.   if (attrValue == 'vk_share') {price = <? echo $user['price_adv_vk_share'] != '0' ? $user['price_adv_vk_share'] : $config_extra['default_price_vk_share']; ?>;}
  10.   if (attrValue == 'vk_like') {price = <? echo $user['price_adv_vk_like'] != '0' ? $user['price_adv_vk_like'] : $config_extra['default_price_vk_like']; ?>;}
  11.   if (attrValue == 'vk_friends') {price = <? echo $user['price_adv_vk_friends'] != '0' ? $user['price_adv_vk_friends'] : $config_extra['default_price_vk_friends']; ?>;}
  12.   console.log(obj, price);
  13.  
  14.   $("#budget").text( $("input[name=amount_users_limit]").attr("value") * price );
  15.   $("#price").text( price );
  16. }
  17.  
  18.      $(document).ready(function(){
  19.         $.Placeholder.init({ color : "#aaa" });
  20.  
  21.         changePrice($("input[name=type]", ".jq-radio").first());
  22.         /* Клик по типу задания */
  23.         $("input[name=type]", ".jq-radio").click(function() {
  24.           changePrice($(this));
  25.         });
  26.    
  27.         /* Изменение количества заданий */
  28.         $("input[name=amount_users_limit]").on('input', function() {
  29.           changePrice($("input:radio:checked"));
  30.         });
  31.  
  32.         /* Клик по страховке */
  33.         $("input[name=insurance]", ".jq-checkbox").click(function() {
  34.           changePrice($("input:radio:checked"));
  35.         });
  36.  
  37.     });
  38.   </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement