...

View Full Version : Problem with code on IE



pitiopia
08-16-2005, 07:21 PM
Hello everyone!

I have a function with mixed js and php code. It is plased in file change.php


function zrob_tabele() {
var xx1=x-4;
var yy1=y-4;
var xx=x+9-4;
var yy=y+9-4;
mytable = document.createElement("TABLE");
mytablebody = document.createElement("TBODY");
for(j=yy1;j<yy;j++) {
mycurrent_row=document.createElement("TR");
for(i=xx1;i<xx;i++) {
mycurrent_cell=document.createElement("TD");
if(i<1 || i>40 || j<1 || j>40) {
mycurrent_cell.setAttribute("bgcolor", "black");
currenttext=document.createTextNode(' ');

}else {
mycurrent_cell.setAttribute("background", "trawa.gif");
mycurrent_cell.onclick = function () { show_info(event, 1, 100,100); };
mycurrent_cell.onmousemove = function () { show_info(event, 1, 100,100); };
mycurrent_cell.onmouseout = function () { show_info(event, 2, 100,100); };
currenttext=document.createTextNode('');
mycurrent_cell.setAttribute("id", j+'-'+i);
}
mycurrent_cell.setAttribute("width","<? echo $szerokosc; ?>");
mycurrent_cell.setAttribute("height","<? echo $wysokosc; ?>");


mycurrent_cell.appendChild(currenttext);
mycurrent_row.appendChild(mycurrent_cell);
}
mytablebody.appendChild(mycurrent_row);
}
mytable.appendChild(mytablebody);

mytable.setAttribute("border","0");
mytable.setAttribute("width","<? echo $ile_pol*40; ?>");
mytable.setAttribute("cellspacing","0");
mytable.setAttribute("cellpadding","0");
mytable.setAttribute("style","border-top: 1px solid; border-bottom: 1px solid; border-left: 1px solid; border-right: 1px solid; border-color: black");
mytable.setAttribute("id","plansza_small");
self.parent.usun_tabele('dss');
self.parent.pokaz(mytable);
}


in other file i have other function

function pokaz(x) {
var mybody=document.getElementsByTagName("div").item(0);
mybody.appendChild(x);
}

when i load this script on Fire Fox then everything works fine, but when i load it on IE then an error appears on function pokaz() that there is a wrong argument.

Can someone help and tell me whats wrong?

Thanks in advance!

martin_narg
08-16-2005, 08:35 PM
your problem lies with passing the event object object in you show_info() function, in IE this object does not exists - the IE object you require is window.event.

Please post up the show_info() function so a cross-browser solution can be given.

cheers!

m_n



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum