Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem with code on IE

    Hello everyone!

    I have a function with mixed js and php code. It is plased in file change.php
    Code:
    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
    Code:
    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!

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    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
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •