Как ще стане това за този JS ?

dan4o

Registered
Този JS може ли да се направи да служи за определена таблица с id или class ...

// <![CDATA[
function resizeimg()
{
if (document.getElementsByTagName)
{
for (i=0; i<document.getElementsByTagName('img').length; i++)
{
im = document.getElementsByTagName('img');
if (im.width > 350)
{
im.style.width = '350px';
eval("pop" + String(i) + " = new Function(\"pop = window.open('" + im.src + " ','fullscale','width=600,height=400,scrollbars=1,resizable=1'); pop.focus();\")");
eval("im.onclick = pop" + String(i) + ";");
if (document.all) im.style.cursor = 'hand';
if (!document.all) im.style.cursor = 'pointer';
im.title = 'Click';
}
}
}
}
// ]]>
 
Пробвай:
// <![CDATA[
function resizeimg()
{
if (document.getElementsByTagName)
{
for (i=0; i<document.getElementsByTagName('img').length; i++)
{
im = document.getElementsByTagName('table');
if (im.width > 350)
{
im.style.width = '350px';
eval("pop" + String(i) + " = new Function(\"pop = window.open('" + im.src + " ','fullscale','width=600,height=400,scrollbars=1,resizable=1'); pop.focus();\")");
eval("im.onclick = pop" + String(i) + ";");
if (document.all) im.style.cursor = 'hand';
if (!document.all) im.style.cursor = 'pointer';
im.title = 'Click';
}
}
}
}
// ]]>
 
Не тоя JS да важи за дадена таблица не за целия сайт както е сега :P
тоя JS е resize ....
 

Back
Горе