Не понимаю код, строчку...
Не могу полностью понять строчку
var objBody = this.doc.getElementsByTagName("body").item(0); doc это эквивалент document? Что такое item(0)? зы Гугл не помог:( . |
Цитата:
Цитата:
|
А что, document.body где-то не поддерживается???
Цитата:
document.getElementsByTagName("body")[1]; //Вернет undefined
document.getElementsByTagName("body").item(1); //Вернет null
|
Цитата:
|
По смыслу это сохранённая ссылка на document. По факту может быть всё, что угодно.
|
Цитата:
Может там лежит копия объекта document)) blablabla <script> var doc = document; alert(doc.body.innerHTML); </script> |
Цитата:
Привожу ниже весь код до строчки this.doc.getElementsByTagName("body").item(0).
Array.prototype.removeDuplicates = function () { for (var i = 1; i < this.length; i++) { if (this[i][0] == this[i-1][0]) { this.splice(i,1); } } }
Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }
String.prototype.trim = function () { return this.replace(/^\s+|\s+$/g, ''); }
function LyteBox() {
this.theme = 'red';
this.hideFlash = true;
this.outerBorder = true;
this.resizeSpeed = 8;
this.maxOpacity = 80; /
this.navType = 1; // 1 = "Prev/Next" buttons on top left and left (default), 2 = "<< prev | next >>" links next to image number
this.autoResize = true;
this.doAnimations = true;
this.borderSize = 12;
this.slideInterval = 4000;
this.showNavigation = true;
this.showClose = true;
this.showDetails = true;
this.showPlayPause = true;
this.autoEnd = true;
this.pauseOnNextClick = false;
this.pauseOnPrevClick = true;
if(this.resizeSpeed > 10) { this.resizeSpeed = 10; }
if(this.resizeSpeed < 1) { resizeSpeed = 1; }
this.resizeDuration = (11 - this.resizeSpeed) * 0.15;
this.resizeWTimerArray = new Array();
this.resizeWTimerCount = 0;
this.resizeHTimerArray = new Array();
this.resizeHTimerCount = 0;
this.showContentTimerArray = new Array();
this.showContentTimerCount = 0;
this.overlayTimerArray = new Array();
this.overlayTimerCount = 0;
this.imageTimerArray = new Array();
this.imageTimerCount = 0;
this.timerIDArray = new Array();
this.timerIDCount = 0;
this.slideshowIDArray = new Array();
this.slideshowIDCount = 0;
this.imageArray = new Array();
this.activeImage = null;
this.slideArray = new Array();
this.activeSlide = null;
this.frameArray = new Array();
this.activeFrame = null;
this.checkFrame();
this.isSlideshow = false;
this.isLyteframe = false;
/*@cc_on
/*@if (@_jscript)
this.ie = (document.all && !window.opera) ? true : false;
/*@else @*/
this.ie = false;
/*@end
@*/
this.ie7 = (this.ie && window.XMLHttpRequest);
this.initialize();
}
LyteBox.prototype.initialize = function() {
this.updateLyteboxItems();
var objBody = this.doc.getElementsByTagName("body").item(0);
.....
|
Вот это:
Array.prototype.empty = function () { for (var i = 0; i <= this.length; i++) { this.shift(); } }
ваще fail аффтора! Тупая и долгая функция, бессмысленно срущая в прототип:)А по теме: 1. Почему бы не написать console.log(this) и там не посмотреть? 2. Этот doc может определяться и ниже, типа: LyteBox.prototype.doc = document; |
Ясн. Спасибо. Я всё понял
|
| Часовой пояс GMT +3, время: 18:30. |