运行Ext4.2.1的一个例子,报错:Ext未定义 但是Ctr1+左键点击src可以导向到打开引入文件。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我是看教程的啊,说4.X版本引入bootstrap.js就行了,这个里面自行判定是否引入 我重新引入了ext-all,就不报错了,哎教程上明明说这个是4.x版本只需引入bootstrap.js的 bootstrap.js中引用的ext-all.js的路径 有这个js吗? (function() { var scripts = document.getElementsByTagName('script'), localhostTests = [ /^localhost$/, /\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:\d{1,5})?\b/ // IP v4 ], host = window.location.hostname, isDevelopment = null, queryString = window.location.search, test, path, i, ln, scriptSrc, match; for (i = 0, ln = scripts.length; i < ln; i++) { scriptSrc = scripts[i].src; match = scriptSrc.match(/bootstrap\.js$/); if (match) { path = scriptSrc.substring(0, scriptSrc.length - match[0].length); break; } } if (queryString.match('(\\?|&)debug') !== null) { isDevelopment = true; } else if (queryString.match('(\\?|&)nodebug') !== null) { isDevelopment = false; } if (isDevelopment === null) { for (i = 0, ln = localhostTests.length; i < ln; i++) { test = localhostTests[i]; if (host.search(test) !== -1) { isDevelopment = true; break; } } } if (isDevelopment === null && window.location.protocol === 'file:') { isDevelopment = true; } document.write('<script type="text/javascript" charset="UTF-8" src="' + path + 'ext-all' + (isDevelopment ? '-dev' : '') + '.js"></script>');})(); 上面是bootstrap.js的源码,要保存bootstrap.js文件的路径的,然后再根据情况拼ext-all.js或者ext-all-debug.js的路径进行导入。我的这两个文件和bootstrap.js在同一个文件夹下面。我再源码第一行都添加了alert(),只有bootstrap.js加载了。 ajax都是用json传值吗 javascript贪吃蛇,面向对象 JavaScript超链接触发事件 dojo [吐血推荐]Ajax从入门到精通!! getElementById提示为空或不是对象 引用js文件的问题 用js有办法访问客户端的指定路径的文件吗 按钮的服务器和客户端click事件 用JAVASCRIPT如何实现自动刷新页面? js动态添加文本框后前面文本框里面内容被清除 js 正则表达式 验证问题
var scripts = document.getElementsByTagName('script'),
localhostTests = [
/^localhost$/,
/\b(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(:\d{1,5})?\b/ // IP v4
],
host = window.location.hostname,
isDevelopment = null,
queryString = window.location.search,
test, path, i, ln, scriptSrc, match; for (i = 0, ln = scripts.length; i < ln; i++) {
scriptSrc = scripts[i].src; match = scriptSrc.match(/bootstrap\.js$/); if (match) {
path = scriptSrc.substring(0, scriptSrc.length - match[0].length);
break;
}
} if (queryString.match('(\\?|&)debug') !== null) {
isDevelopment = true;
}
else if (queryString.match('(\\?|&)nodebug') !== null) {
isDevelopment = false;
} if (isDevelopment === null) {
for (i = 0, ln = localhostTests.length; i < ln; i++) {
test = localhostTests[i]; if (host.search(test) !== -1) {
isDevelopment = true;
break;
}
}
} if (isDevelopment === null && window.location.protocol === 'file:') {
isDevelopment = true;
} document.write('<script type="text/javascript" charset="UTF-8" src="' +
path + 'ext-all' + (isDevelopment ? '-dev' : '') + '.js"></script>');
})();