0
我想創建一個包含每個js文件的js文件,以將它們附加到它所在的head標籤。將js文件附加到一個js文件,但帶有JQuery錯誤!
但我得到這個錯誤
Microsoft JScript runtime error: Object expected
這是我的代碼:
var baseUrl = document.location.protocol + "//" + document.location.host + '/yabant/';
// To find root path with virtual directory
function ResolveUrl(url) {
if (url.indexOf("~/") == 0) {
url = baseUrl + url.substring(2);
}
return url;
}
// JS dosyalarının tek noktadan yönetilmesi
function addJavascript(jsname, pos) {
var th = document.getElementsByTagName(pos)[0];
var s = document.createElement('script');
s.setAttribute('type', 'text/javascript');
s.setAttribute('src', jsname);
th.appendChild(s);
}
addJavascript(ResolveUrl('~/js/1_jquery-1.4.2.min.js'), 'head');
$(document).ready(function() {
addJavascript(ResolveUrl('~/js/5_json_parse.js'), 'head');
addJavascript(ResolveUrl('~/js/3_jquery.colorbox-min.js'), 'head');
addJavascript(ResolveUrl('~/js/4_AjaxErrorHandling.js'), 'head');
addJavascript(ResolveUrl('~/js/6_jsSiniflar.js'), 'head');
addJavascript(ResolveUrl('~/js/yabanYeni.js'), 'head');
addJavascript(ResolveUrl('~/js/7_ResimBul.js'), 'head');
addJavascript(ResolveUrl('~/js/8_HaberEkle.js'), 'head');
addJavascript(ResolveUrl('~/js/9_etiketIslemleri.js'), 'head');
addJavascript(ResolveUrl('~/js/bugun.js'), 'head');
addJavascript(ResolveUrl('~/js/yaban.js'), 'head');
addJavascript(ResolveUrl('~/embed/bitgravity/functions.js'), 'head');
});
路徑是正確的。我想告訴你文件夾結構和麪板:
任何幫助將不勝感激。
「document.write腳本標記 - 使用document.write將
來源
2010-03-31 12:42:21 uzay95