Plugin Directory

Changeset 476243


Ignore:
Timestamp:
12/16/2011 06:31:35 AM (14 years ago)
Author:
1tui8
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-alicart/trunk/alicart_javascripts.php

    r476224 r476243  
    1 <?php
     1<?php
    22function alicart_jquery_javascript()
    33{
     
    3939    <script type="text/javascript">
    4040    <!--//
    41     $().ready(function() {
    42         $("form .inputtext:input").blur(function() {
    43             var $parent = $(this).parent();
     41    jQuery.noConflict();
     42
     43    jQuery().ready(function() {
     44        jQuery("form .inputtext:input").blur(function() {
     45            var $parent = jQuery(this).parent();
    4446            $parent.find(".prompt").remove();
    4547   
    46             if($(this).is("#consignee")) {
     48            if(jQuery(this).is("#consignee")) {
    4749                if(this.value=="") {
    4850                    var errorMsg = "请填写收款人姓名";
     
    5153            }
    5254           
    53             if($(this).is("#address")) {
     55            if(jQuery(this).is("#address")) {
    5456                if(this.value=="") {
    5557                    var errorMsg = "请详细填写省/市/区/街道";
     
    5860            }
    5961           
    60             if($(this).is("#zip_code")) {
     62            if(jQuery(this).is("#zip_code")) {
    6163                if(this.value=="") {
    6264                    var errorMsg = "请填写邮政编码";
     
    6870            }
    6971           
    70             if($(this).is(".phone")) {
    71                 if($("#phone_section").val()!="" || $("#phone_code").val()!="" || $("#phone_ext").val()!="") {
    72                     if(isNaN($("#phone_section").val()) || $("#phone_section").val().length < 3 || $("#phone_section").val().length > 4 || isNaN($("#phone_code").val()) || $("#phone_code").val().length < 6 || $("#phone_code").val().length > 9 || isNaN($("#phone_ext").val())) {
     72            if(jQuery(this).is(".phone")) {
     73                if(jQuery("#phone_section").val()!="" || jQuery("#phone_code").val()!="" || jQuery("#phone_ext").val()!="") {
     74                    if(isNaN($("#phone_section").val()) || $("#phone_section").val().length < 3 || jQuery("#phone_section").val().length > 4 || isNaN(jQuery("#phone_code").val()) || jQuery("#phone_code").val().length < 6 || jQuery("#phone_code").val().length > 9 || isNaN(jQuery("#phone_ext").val())) {
    7375                        var errorMsg = "请填写正确的电话号码";
    7476                        $parent.append("<span class=\'prompt onError\'>"+errorMsg+"</span>");
     
    7779            }
    7880           
    79             if($(this).is("#mobile_phone")) {
     81            if(jQuery(this).is("#mobile_phone")) {
    8082                if(this.value != "") {
    8183                    if(isNaN(this.value) || this.value.length != 11) {
     
    8789   
    8890        }).keyup(function() {
    89             $(this).triggerHandler("blur");
     91            jQuery(this).triggerHandler("blur");
    9092        }).focus(function() {
    91             $(this).triggerHandler("blur");
     93            jQuery(this).triggerHandler("blur");
    9294        });
    9395   
    94         $(".alicart_go_my_cart").click(function() {
    95             $("form .inputtext:input").trigger("blur");
    96             var errorNum = $("form .onError").length;
     96        jQuery(".alicart_go_my_cart").click(function() {
     97            jQuery("form .inputtext:input").trigger("blur");
     98            var errorNum = jQuery("form .onError").length;
    9799            if(errorNum) {
    98100                return false;
Note: See TracChangeset for help on using the changeset viewer.