Форум: Форум PHPФорум ApacheФорум Регулярные ВыраженияФорум MySQLHTML+CSS+JavaScriptФорум FlashРазное
Новые темы: 0000000
Самоучитель PHP 5 / 6 (3 издание). Авторы: Кузнецов М.В., Симдянов И.В. C++. Мастер-класс в задачах и примерах. Авторы: Кузнецов М.В., Симдянов И.В. PHP 5/6. В подлиннике. Авторы: Кузнецов М.В., Симдянов И.В. PHP на примерах (2 издание). Авторы: Кузнецов М.В., Симдянов И.В. PHP 5. На примерах. Авторы: Кузнецов М.В., Симдянов И.В., Голышев С.В.
ВСЕ НАШИ КНИГИ
Консультационный центр SoftTime

HTML+CSS+JavaScript

Выбрать другой форум

 

Здравствуйте, Посетитель!

вид форума:
Линейный форум Структурный форум

тема: скрипт не работает в других браузерах
 
 автор: alexan   (30.04.2011 в 18:50)   письмо автору
 
 

Здравствуйте знатоки.
Есть проблемка со скриптом. Это динамический пазл. В IE во всех версиях работает, а вот в других браузерах отказывается напрочь. Может поможете, очень надо.
Вот код скрипта:

function defineImages() {
picPool[0] = new picPara("laputa1.jpg",800,600,5,4,10,"image from Laputa, 800x600, 5x4, 24kb");
picPool[1] = new picPara("laputa2.jpg",760,540,4,5,10,"image from Laputa, 760x540, 5x4, 26kb");
picPool[2] = new picPara("laputa3.jpg",800,560,5,4,10,"image from Laputa, 800x560, 5x4, 45kb");
picPool[3] = new picPara("laputa4.jpg",780,540,6,5,10,"image from Laputa, 780x540, 5x4, 20kb");
}

//------ you don't need to care about the following codes ------

var isIE4 = false; isNN4 = false;

var picPool = new Array();
var pic_image_source = "";
var pic_image_width = 0;
var pic_image_height = 0;
var pic_grip_x = 1;
var pic_grip_y = 1;
var pic_table_gap = 0;

var puzzle_window = null;

function mouseHover() {
window.status = picPool[this.index].info;
return true;
}

function mouseGone() {
window.status = window.defaultStatus;
return true;
}

function mouseClick() {
goPuzzleX(this.index);
return false;
}

function picPara(image_source,image_width,image_height,grip_x,grip_y,table_gap,image_info) {
this.source = image_source;
this.width = image_width;
this.height = image_height;
this.grip_x = grip_x;
this.grip_y = grip_y;
this.table_gap = table_gap;
this.info = image_info;
}

function setupImages() {
isIE4 = (document.all)?true:false; isNN4 = (document.layers)?true:false;

defineImages();

var linksCount = document.links.length, hashIndex = -1, puzzleIndex = -1, hashTag = "puzzlex";
for (var i = 0; i < linksCount; i++) {
hashIndex = document.links[i].hash.indexOf(hashTag);
if (hashIndex != -1) {
puzzleIndex = parseInt(document.links[i].hash.substring(hashIndex+7));
document.links[i].index = puzzleIndex;
document.links[i].onmouseover = mouseHover;
document.links[i].onmouseout = mouseGone;
document.links[i].onclick = mouseClick;
}
}
}

function Build_Puzzle() {
var window_para = "width=" + (pic_image_width + pic_table_gap * 6) +",height=" + (pic_image_height + pic_table_gap * 6) + ",titlebar=1";

if (isIE4 || isNN4) {
if (puzzle_window != null)
if (!puzzle_window.closed)
puzzle_window.close();

puzzle_window = window.open("puzzlex.html", "Puzzle_Window", window_para); }
else {
alert("Sorry !\nYou need a version 4 or above browser.");
}
}

function goPuzzleX(pic_index) {
pic_image_source = picPool[pic_index].source;
pic_image_width = picPool[pic_index].width;
pic_image_height = picPool[pic_index].height;
pic_grip_x = picPool[pic_index].grip_x;
pic_grip_y = picPool[pic_index].grip_y;
pic_table_gap = picPool[pic_index].table_gap;

Build_Puzzle();
}

  Ответить  
 
 автор: elenaki   (01.05.2011 в 20:36)   письмо автору
 
   для: alexan   (30.04.2011 в 18:50)
 

судя по вот этому
var isIE4 = false; isNN4 = false;
скрипт старинный, можно даже сказать, древний. поищите другой. переделывать дороже выйдет

  Ответить  
Rambler's Top100
вверх

Rambler's Top100 Яндекс.Метрика Яндекс цитирования