избавиться от document.all

A
На сайте с 10.05.2008
Offline
48
508

Есть код:


<script>
function wopen(filename,sx,sy)
{
sx = sx - 0;
sy = sy - 0;
sx = sx + 40;
sy = sy + 40;
var sizey = 0;
var sizex = 0;
if (sx > screen.width)
{
sizex = screen.width - 5;
}
else
{
sizex = sx;
}
if (sy > screen.height)
{
sizey = screen.height - 5;
}
else
{
sizey = sy;
}
var x = (screen.width - sizex) / 2;
var y = (screen.height - sizey) / 2;
var set="toolbar=no, menubar=no, width="+sizex+", scrollbars=no, height="+sizey+",top="+y+",left="+x;
window.open(filename, "", set);
function allGetElementById(id)
{
return document.all[id];
}
function evalGetElementById(id)
{
eval("var e=self."+id+";");
return e;
}
function execGetElementById(id)
{
window.execScript("var e=self."+id+";","JavaScript")
return e;
}
function nullGetElementById(id)
{
return null;
}
if (document.getElementById){;}
else if(document.all)
{ document.getElementById=allGetElementById;}
else if(eval && self)
{document.getElementById=evalGetElementById;}
else if(window.execScript && self)
{document.getElementById=execGetElementById;}
else
{document.getElementById=nullGetElementById;}
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="50%" align="center" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<form name='imagex'>
<?
$res1 = mysql_query("select id,name,bname,title from dop_img where par_id = '".$id."'");
$is_img = false;
$numpic = mysql_num_rows($res1);
if ($row1 = mysql_fetch_array($res1))
{
$size = getimagesize("img/".$row1['bname']);
?>
<input type='hidden' name='imgx' value='<?= $size[0];?>'>
<input type='hidden' name='imgy' value='<?= $size[1];?>'>
<input type='hidden' name='imgid' value='<?= $row1['id'];?>'>
<td align="center"><img src="showmed.php?id=<?= $row1[id];?>" id='tumbmed' width="200" height="200" onclick='wopen("/gal.php?id="+document.all.imagex.imgid.value,document.all.imagex.imgx.value,document.all.imagex.imgy.value)' style="cursor:pointer;cursor:hand;" alt="Ноутбук <?= stripslashes($ro['caption'])?>. Купить ноутбук <?= stripslashes($ro['caption'])?>" ></td><?
}
else
{
?><td align="center"><img src="/pic/nofoto.gif"></td><?
}
?>
</tr>
</form>
</table>

Как правильно изменить функцию document.all чтобы код воспринимался в мазилле? Если можно, объясните поподробнее, т.к. в яваскрипте нуб...:(

скрипт автопортала (http://autocrimea.info/) - для приобретения стучите в личку
BG
На сайте с 09.10.2010
Offline
3
#1

А можно вопрос - что эта форма должна делать? А то из кода не сразу понятно.

A
На сайте с 10.05.2008
Offline
48
#2
Boeses_Genie:
А можно вопрос - что эта форма должна делать? А то из кода не сразу понятно.

Должна была открывать изображение в всплывающем окне с заданными размерами. Решение найдено путем перехода на jquery, вопрос снят.

Авторизуйтесь или зарегистрируйтесь, чтобы оставить комментарий