Показать сообщение отдельно
  #3 (permalink)  
Старый 28.01.2012, 15:06
Аватар для Gvozd
Матрос
Отправить личное сообщение для Gvozd Посмотреть профиль Найти все сообщения от Gvozd
 
Регистрация: 04.04.2008
Сообщений: 6,246

Как-то так, например:
function js_include(src, onload, onerror) {
	var js = document.createElement('script');
	js.onload = onload;
	js.onerror = onerror;
	js.setAttribute('type', 'text/javascript');
	js.setAttribute('src', src);
	js.setAttribute('defer', 'defer');
	document.getElementsByTagName('HEAD')[0].appendChild(js);
}
js_include('http://code.jquery.com/jquery-1.7.1.js', function(){
		alert('load: http://code.jquery.com/jquery-1.7.1.js');
	}, function(){
		alert('error: http://code.jquery.com/jquery-1.7.1.js');
	});
js_include('http://code.jquery.com/jquery-1.7.1.js.error', function(){
		alert('load: http://code.jquery.com/jquery-1.7.1.js.error');
	}, function(){
		alert('error: http://code.jquery.com/jquery-1.7.1.js.error');
	});
Ответить с цитированием