Mam problem z kodem javascript na stronie http://www.komplex.cc/.
Strona nie działa w IE. FF nie zwraca żadnych błędów.
Kod
  1. <script type="text/javascript">
  2. var xmlhttp;
  3. var old_x;
  4. var old_y;
  5.  
  6.  
  7.  
  8. var w = 0, h = 0;
  9.  
  10.  
  11.  
  12. function getwh(){
  13. //alert("jgjg");
  14. if( typeof( window.innerWidth ) == 'number' ) {
  15. //Non-IE
  16. w = window.innerWidth;
  17. h = window.innerHeight;
  18.  
  19. }
  20.  
  21. else{
  22.  
  23. window.location = "./ie.html"
  24.  
  25. }
  26.  
  27. }
  28. function display_info(i,u,x,y,t,l,c){
  29.  
  30. display_infoimg("");
  31.  
  32. info = document.getElementById("info");
  33. rect = document.getElementById("rect");
  34.  
  35.  
  36.  
  37. if(u=="" || (old_x==x && old_y==y)){
  38.  
  39.  
  40. info.innerHTML = '';
  41. rect.style.width = '0px';
  42. rect.style.height = '0px';
  43. old_x = x;
  44. old_y = y;
  45.  
  46.  
  47. }
  48.  
  49. else{
  50.  
  51. info.style.zindex = '50';
  52. if(i==""){infostring = '<b>'+ u + '</b>';}
  53. else{
  54. infostring = '<b>'+ u + '</b><br><i>' + i + '</i>';}
  55. info.innerHTML = infostring;
  56. rect.style.position = 'fixed';
  57. rect.style.left = l + 1 + 'px';
  58. rect.style.top = t + 1 + 'px';
  59. rect.style.backgroundColor = '#' + c ;
  60. rect.style.zindex = '25';
  61. rect.style.width = '599px';
  62. rect.style.height = '599px';
  63.  
  64.  
  65. if( rect.attachEvent ){
  66. rect.attachEvent('onclick', 'cell('+ x + ',' + y + ')');
  67. } else {
  68. rect.setAttribute('onclick', 'cell('+ x + ',' + y + ')');
  69. }
  70.  
  71. old_x = x;
  72. old_y = y;
  73.  
  74. }
  75.  
  76. }
  77.  
  78. function display_infomap(i,u){
  79.  
  80.  
  81.  
  82. info = document.getElementById("info");
  83.  
  84.  
  85. if(u=="" && i==""){
  86.  
  87.  
  88. info.innerHTML = '';
  89.  
  90.  
  91. }
  92.  
  93. else{
  94.  
  95.  
  96. info.style.zindex = '50';
  97. if(i==""){
  98. infostring = '<b>'+ u + '</b>';}
  99. else{
  100.  
  101. infostring = '<b>'+ u + '</b><br><i>' + i + '</i>';}
  102.  
  103. info.innerHTML = infostring;
  104. }
  105.  
  106. }
  107.  
  108. function display_infoimg(i, x){
  109.  
  110. //hide_info();
  111.  
  112.  
  113.  
  114. infoimg = document.getElementById("infoimg");
  115.  
  116. infoimg.style.zindex = '100';
  117. infoimg.innerHTML = i;
  118.  
  119. if(x==1){
  120.  
  121. info = document.getElementById("info").innerHTML = "";
  122. infoimg.style.color = '#ff0000';
  123.  
  124. }
  125.  
  126. else {
  127.  
  128.  
  129. infoimg.style.color = '#333333';
  130.  
  131. }
  132.  
  133. }
  134.  
  135. function hide_info(){
  136.  
  137. //////////////////
  138.  
  139.  
  140. rect = document.getElementById("rect");
  141. info = document.getElementById("info");
  142. info.innerHTML = '';
  143. rect.style.width = '0px';
  144. rect.style.height = '0px';
  145. rect.style.position = 'fixed';
  146. rect.style.left = '-1px';
  147. rect.style.top = '-1px';
  148. old_x = 0;
  149. old_y=0;
  150.  
  151.  
  152. }
  153.  
  154. function wind_scroll(x,y){
  155.  
  156.  
  157. window.scroll(x,y);
  158.  
  159. }
  160.  
  161. function logout(){
  162.  
  163. var url="login.php?f=logout";
  164. url+="&w="+w;
  165. url+="&h="+h;
  166. xmlhttp.onreadystatechange=stateChanged;
  167. xmlhttp.open("GET",url,true);
  168. xmlhttp.send(null);
  169.  
  170. }
  171.  
  172. function login(){
  173.  
  174.  
  175. var url="login.php";
  176. xmlhttp.onreadystatechange=stateChanged;
  177. xmlhttp.open("GET",url,true);
  178. xmlhttp.send(null);
  179.  
  180. }
  181.  
  182. function add_user(x,y){
  183.  
  184. display_infoimg("");
  185.  
  186. l1 = document.getElementById("l1").value;
  187. l2 = document.getElementById("l2").value;
  188. l3 = document.getElementById("l3").value;
  189.  
  190. xmlhttp=GetXmlHttpObject();
  191. if (xmlhttp==null)
  192. {
  193. alert ("Browser does not support HTTP Request");
  194. return;
  195. }
  196. var url="cell.php";
  197. url+="?x="+x;
  198. url+="&y="+y;
  199. url+="&w="+w;
  200. url+="&h="+h;
  201. url+="&f=add_user";
  202. url+="&username="+l1;
  203. url+="&password="+l2;
  204. url+="&color="+l3;
  205. xmlhttp.onreadystatechange=stateChanged;
  206. xmlhttp.open("GET",url,true);
  207. xmlhttp.send(null);
  208.  
  209.  
  210. }
  211.  
  212. function add_user_form(x,y){
  213.  
  214. display_infoimg("");
  215.  
  216. hide_info();
  217.  
  218. xmlhttp=GetXmlHttpObject();
  219. if (xmlhttp==null)
  220. {
  221. alert ("Browser does not support HTTP Request");
  222. return;
  223. }
  224. var url="cell.php";
  225. url+="?x="+x;
  226. url+="&y="+y;
  227. url+="&w="+w;
  228. url+="&h="+h;
  229. url+="&f=add_user_form";
  230. xmlhttp.onreadystatechange=stateChanged;
  231. xmlhttp.open("GET",url,true);
  232. xmlhttp.send(null);
  233.  
  234.  
  235. }
  236.  
  237. function add_content1(x,y){
  238.  
  239. display_infoimg("");
  240.  
  241. l1 = document.getElementById("content_type").value;
  242.  
  243.  
  244. xmlhttp=GetXmlHttpObject();
  245. if (xmlhttp==null)
  246. {
  247. alert ("Browser does not support HTTP Request");
  248. return;
  249. }
  250. var url="cell.php";
  251. url+="?x="+x;
  252. url+="&y="+y;
  253. url+="&w="+w;
  254. url+="&h="+h;
  255. url+="&f=add_content1";
  256. url+="&type="+l1;
  257. xmlhttp.onreadystatechange=stateChanged;
  258. xmlhttp.open("GET",url,true);
  259. xmlhttp.send(null);
  260.  
  261.  
  262. }
  263.  
  264. function edit1(x,y)
  265. {
  266.  
  267. display_infoimg("");
  268.  
  269. hide_info();
  270.  
  271. xmlhttp=GetXmlHttpObject();
  272. if (xmlhttp==null)
  273. {
  274. alert ("Browser does not support HTTP Request");
  275. return;
  276. }
  277. var url="cell.php";
  278. url+="?x="+x;
  279. url+="&y="+y;
  280. url+="&w="+w;
  281. url+="&h="+h;
  282. url+="&f=edit1";
  283. xmlhttp.onreadystatechange=stateChanged;
  284. xmlhttp.open("GET",url,true);
  285. xmlhttp.send(null);
  286.  
  287.  
  288. }
  289.  
  290. function delcell(x,y)
  291. {
  292.  
  293. display_infoimg("");
  294.  
  295. hide_info();
  296.  
  297. xmlhttp=GetXmlHttpObject();
  298. if (xmlhttp==null)
  299. {
  300. alert ("Browser does not support HTTP Request");
  301. return;
  302. }
  303. var url="cell.php";
  304. url+="?x="+x;
  305. url+="&y="+y;
  306. url+="&w="+w;
  307. url+="&h="+h;
  308. url+="&f=delcell";
  309. xmlhttp.onreadystatechange=stateChanged;
  310. xmlhttp.open("GET",url,true);
  311. xmlhttp.send(null);
  312.  
  313.  
  314. }
  315.  
  316.  
  317.  
  318. function cell(x,y)
  319. {
  320.  
  321. display_infoimg("");
  322. getwh();
  323.  
  324. hide_info();
  325.  
  326. //alert(x + ' ' + y);
  327. xmlhttp=GetXmlHttpObject();
  328. if (xmlhttp==null)
  329. {
  330. alert ("Browser does not support HTTP Request");
  331. return;
  332. }
  333. var url="cell.php";
  334. url+="?x="+x;
  335. url+="&y="+y;
  336. url+="&w="+w;
  337. url+="&h="+h;
  338. url+="&f=closeup";
  339. xmlhttp.onreadystatechange=stateChanged;
  340. xmlhttp.open("GET",url,true);
  341. xmlhttp.send(null);
  342. }
  343.  
  344. function map()
  345. {
  346.  
  347. getwh();
  348.  
  349. hide_info();
  350. display_infoimg(' ');
  351. //alert(x + y);
  352. xmlhttp=GetXmlHttpObject();
  353. if (xmlhttp==null)
  354. {
  355. alert ("Browser does not support HTTP Request");
  356. return;
  357. }
  358. var url="cell.php";
  359. url+="?x=0";
  360. url+="&y=0";
  361. url+="&w="+w;
  362. url+="&h="+h;
  363. url+="&f=map";
  364. xmlhttp.onreadystatechange=stateChanged;
  365. xmlhttp.open("GET",url,true);
  366. xmlhttp.send(null);
  367. }
  368.  
  369. function stateChanged()
  370. {
  371.  
  372. if (xmlhttp.readyState==4)
  373. {
  374.  
  375. document.getElementById('main').innerHTML=xmlhttp.responseText;
  376. }
  377. }
  378.  
  379. function GetXmlHttpObject()
  380. {
  381. if (window.XMLHttpRequest)
  382. {
  383. // code for IE7+, Firefox, Chrome, Opera, Safari
  384. //alert("huj");
  385. return new XMLHttpRequest();
  386. }
  387. if (window.ActiveXObject)
  388. {
  389. // code for IE6, IE5
  390.  
  391. return new ActiveXObject("Microsoft.XMLHTTP");
  392. }
  393. return null;
  394. }

i
  1. <script type="text/javascript">
  2. <!--
  3.  
  4.  
  5. //document.addEventListener('mousemove', skinableCursor.move, false);
  6.  
  7. // Detect if the browser is IE or not.
  8. // If it is not IE, we assume that the browser is NS.
  9. var IE = document.all?true:false
  10.  
  11. // If NS -- that is, !IE -- then set up for mouse capture
  12. if (!IE) document.captureEvents(Event.MOUSEMOVE)
  13.  
  14. // Set-up to use getMouseXY function onMouseMove
  15. document.onmousemove = getMouseXY;
  16.  
  17. // Temporary variables to hold mouse x-y pos.s
  18. var tempX = 0
  19. var tempY = 0
  20.  
  21. // Main function to retrieve mouse x-y pos.s
  22.  
  23. function getMouseXY(e) {
  24. if (IE) { // grab the x-y pos.s if browser is IE
  25. tempX = event.clientX + document.body.scrollLeft
  26. tempY = event.clientY + document.body.scrollTop
  27. } else { // grab the x-y pos.s if browser is NS
  28. tempX = e.pageX
  29. tempY = e.pageY
  30. }
  31. // catch possible negative values in NS4
  32. if (tempX < 0){tempX = 0}
  33. if (tempY < 0){tempY = 0}
  34. // show the position values in the form named Show
  35. // in the text fields named MouseX and MouseY
  36.  
  37. var w,h = 0;
  38.  
  39. if( typeof( window.innerWidth ) == 'number' ) {
  40. //Non-IE
  41. w = window.innerWidth;
  42. h = window.innerHeight;
  43. } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
  44. //IE 6+ in 'standards compliant mode'
  45. w = document.documentElement.clientWidth;
  46. h = document.documentElement.clientHeight;
  47. } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
  48. //IE 4 compatible
  49. w = document.body.clientWidth;
  50. h = document.body.clientHeight;
  51. }
  52.  
  53. document.getElementById("info").style.position = 'absolute';
  54. document.getElementById("infoimg").style.position = 'absolute';
  55. var off_x, off_y =0;
  56. if(tempX<w/2){off_x = 10;} else {off_x = -80;}
  57. if(tempY<h/2){off_y = 10;} else {off_y = -80;}
  58. document.getElementById("info").style.left = tempX + off_x;
  59. document.getElementById("info").style.top = tempY + off_y;
  60. document.getElementById("infoimg").style.left = tempX + 10;
  61. document.getElementById("infoimg").style.top = tempY + 10;
  62.  
  63.  
  64.  
  65. return true
  66. }
  67.  
  68. </script>

wydaje mi się że zawodzi ActiveXObject, sprawdze to jeszcze.
Edit: Zawodzi funkcja display_infomap

Pozdrawiam