Heim  >  Fragen und Antworten  >  Hauptteil

javascript - undefined is not a function js报错

/* Zepto 1.1.3 - zepto event ajax form ie detect fx assets data deferred callbacks selector touch gesture stack - zeptojs.com/license */

var Zepto = (function() {
var undefined, key, $, classList, emptyArray = [], slice = emptyArray.slice, filter = emptyArray.filter,
document = window.document,
elementDisplay = {}, classCache = {},
cssNumber = { 'column-count': 1, 'columns': 1, 'font-weight': 1, 'line-height': 1,'opacity': 1, 'z-index': 1, 'zoom': 1 },
fragmentRE = /^\s<(\w+|!)[^>]>/,
singleTagRE = /^<(\w+)\s\/?>(?:<\/\1>|)$/,
tagExpanderRE = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]
)\/>/ig,
rootNodeRE = /^(?:body|html)$/i,
capitalRE = /([A-Z])/g,

// special attributes that should be get/set via method calls
methodAttributes = ['val', 'css', 'html', 'text', 'data', 'width', 'height', 'offset'],

adjacencyOperators = [ 'after', 'prepend', 'before', 'append' ],
table = document.createElement('table'),
tableRow = document.createElement('tr'),
containers = {
  'tr': document.createElement('tbody'),
  'tbody': table, 'thead': table, 'tfoot': table,
  'td': tableRow, 'th': tableRow,
  '*': document.createElement('p')
},
readyRE = /complete|loaded|interactive/,
simpleSelectorRE = /^[\w-]*$/,
class2type = {},
toString = class2type.toString,
zepto = {},
camelize, uniq,
tempParent = document.createElement('p'),
propMap = {
  'tabindex': 'tabIndex',
  'readonly': 'readOnly',
  'for': 'htmlFor',
  'class': 'className',
  'maxlength': 'maxLength',
  'cellspacing': 'cellSpacing',
  'cellpadding': 'cellPadding',
  'rowspan': 'rowSpan',
  'colspan': 'colSpan',
  'usemap': 'useMap',
  'frameborder': 'frameBorder',
  'contenteditable': 'contentEditable'
},
isArray = Array.isArray ||
  function(object){ return object instanceof Array }

zepto.matches = function(element, selector) {
if (!selector || !element || element.nodeType !== 1) return false
var matchesSelector = element.webkitMatchesSelector || element.mozMatchesSelector ||
element.oMatchesSelector || element.matchesSelector
if (matchesSelector) return matchesSelector.call(element, selector)
// fall back to performing a selector:
var match, parent = element.parentNode, temp = !parent
if (temp) (parent = tempParent).appendChild(element)
match = ~zepto.qsa(parent, selector).indexOf(element)
temp && tempParent.removeChild(element)
return match
}

两个zepto都这样定义会不会冲突?

/* Zepto 1.0 - polyfill zepto detect event ajax form fx fx_methods data assets selector touch - zeptojs.com/license */

var Zepto = function() {
function E(a) {
return a == null ? String(a) : y[z.call(a)] || "object"
}
function F(a) {
return E(a) == "function"
}
function G(a) {
return a != null && a == a.window
}
function H(a) {
return a != null && a.nodeType == a.DOCUMENT_NODE
}
function I(a) {
return E(a) == "object"
}
function J(a) {
return I(a) && !G(a) && a.proto == Object.prototype
}
function K(a) {
return a instanceof Array
}
function L(a) {
return typeof a.length == "number"
}
function M(a) {
return g.call(a,
function(a) {
return a != null
})
}
function N(a) {
return a.length > 0 ? c.fn.concat.apply([], a) : a
}
function O(a) {
return a.replace(/::/g, "/").replace(/([A-Z]+)([A-Z][a-z])/g, "$1_$2").replace(/([a-z\d])([A-Z])/g, "$1_$2").replace(/_/g, "-").toLowerCase()
}

大家讲道理大家讲道理2772 Tage vor981

Antworte allen(4)Ich werde antworten

  • PHPz

    PHPz2017-04-10 15:20:58

    就是告诉你调用的function没有定义,打开控制台看是哪个function就知道了

    Antwort
    0
  • 迷茫

    迷茫2017-04-10 15:20:58


    打开控制台,错误信息明显告诉哪行出问题了!点击进去

    Antwort
    0
  • 迷茫

    迷茫2017-04-10 15:20:58

    类型错误,不是一个函数,index.js第38行

    Antwort
    0
  • 迷茫

    迷茫2017-04-10 15:20:58

    点击事件错误

    Antwort
    0
  • StornierenAntwort