Advertisement
Guest User

Untitled

a guest
Nov 26th, 2014
138
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.  
  13.   $("#budget").text( $("input[name=amount_users_limit]").attr("value") * price );
  14.   $("#price").text( price );
  15. }
  16.  
  17.      $(document).ready(function(){
  18.         $.Placeholder.init({ color : "#aaa" });
  19.  
  20.         changePrice($("input[name=type]", ".jq-radio").first());
  21.         /* Клик по типу задания */
  22.         $("input[name=type]", ".jq-radio").click(function() {
  23.           changePrice($(this));
  24.         });
  25.    
  26.         /* Изменение количества заданий */
  27.         $("input[name=amount_users_limit]").on('input', function() {
  28.           changePrice($("input[name=type]:checked"));
  29.         });
  30.  
  31.         /* Клик по страховке */
  32.         $("input[name=insurance]", ".jq-checkbox").click(function() {
  33.           changePrice($("input[name=type]:checked"));
  34.         });
  35.  
  36.     });
  37.   </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement