473,671 Members | 2,257 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IE7 conflicting with JavaScript that works on EVERY other browser! Help!

25 New Member
Hello!

My JavaScripting is at novice level - and after completing a tutorial on a 'floating layer' I was proud that I got it working on Firefox, Safari, Camino & even IE5 for mac!!! But not IE7!
The 'floating layer' does not float in IE7... it just sits up at the top of the screen - stuck in one place!! Explorer - why do you mock us?!!! ;(

I have tried everything - but I am at a loss.
I am thinking maybe it's some conflicting CSS or some crazy update in IE7 which perhaps somebody here knows a way around?
Can someone help me please?

There are two parts to the FLOATING LAYER script - Part 1 in the HEAD,
Part 2 just before </body>

Expand|Select|Wrap|Line Numbers
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
  5. <title>Untitled Document</title>
  6.  
  7. <script type="text/javascript" src="javascript/woeru_tooltip.js"></script>
  8.  
  9.     <script type="text/javascript">
  10.     <!--
  11.     function alignMap() {
  12.         document.getElementById("content").scrollLeft = 0;
  13.         document.getElementById("content").scrollTop = 300;      
  14.     } 
  15.     //-->
  16.     </script>
  17. <STYLE TYPE="text/css">
  18. <!--
  19. BODY {margin: 0}
  20. -->
  21. </STYLE>
  22.  
  23. <!--Here is where Part 1 of the FLOATING LAYER Script starts-->
  24. <SCRIPT LANGUAGE="JavaScript">
  25. <!--
  26. floatX=5;
  27. floatY=5;
  28. layerwidth=20;
  29. layerheight=30;
  30. halign="left";
  31. valign="bottom";
  32. delayspeed=3;
  33.  
  34. // This script is copyright (c) Henrik Petersen, NetKontoret
  35. // Feel free to use this script on your own pages as long as you do not change it.
  36. // It is illegal to distribute the script as part of a tutorial / script archive.
  37. // Updated version available at: http://www.echoecho.com/toolfloatinglayer.htm
  38. // This comment and the 4 lines above may not be removed from the code.
  39.  
  40. NS6=false;
  41. IE4=(document.all);
  42. if (!IE4) {NS6=(document.getElementById);}
  43. NS4=(document.layers);
  44.  
  45. function adjust() {
  46. if ((NS4) || (NS6)) {
  47. if (lastX==-1 || delayspeed==0)
  48. {
  49. lastX=window.pageXOffset + floatX;
  50. lastY=window.pageYOffset + floatY;
  51. }
  52. else
  53. {
  54. var dx=Math.abs(window.pageXOffset+floatX-lastX);
  55. var dy=Math.abs(window.pageYOffset+floatY-lastY);
  56. var d=Math.sqrt(dx*dx+dy*dy);
  57. var c=Math.round(d/10);
  58. if (window.pageXOffset+floatX>lastX) {lastX=lastX+delayspeed+c;}
  59. if (window.pageXOffset+floatX<lastX) {lastX=lastX-delayspeed-c;}
  60. if (window.pageYOffset+floatY>lastY) {lastY=lastY+delayspeed+c;}
  61. if (window.pageYOffset+floatY<lastY) {lastY=lastY-delayspeed-c;}
  62. }
  63. if (NS4){
  64. document.layers['floatlayer'].pageX = lastX;
  65. document.layers['floatlayer'].pageY = lastY;
  66. }
  67. if (NS6){
  68. document.getElementById('floatlayer').style.left=lastX+'px';
  69. document.getElementById('floatlayer').style.top=lastY+'px';
  70. }
  71. }
  72. else if (IE4){
  73. if (lastX==-1 || delayspeed==0)
  74. {
  75. lastX=document.body.scrollLeft + floatX;
  76. lastY=document.body.scrollTop + floatY;
  77. }
  78. else
  79. {
  80. var dx=Math.abs(document.body.scrollLeft+floatX-lastX);
  81. var dy=Math.abs(document.body.scrollTop+floatY-lastY);
  82. var d=Math.sqrt(dx*dx+dy*dy);
  83. var c=Math.round(d/10);
  84. if (document.body.scrollLeft+floatX>lastX) {lastX=lastX+delayspeed+c;}
  85. if (document.body.scrollLeft+floatX<lastX) {lastX=lastX-delayspeed-c;}
  86. if (document.body.scrollTop+floatY>lastY) {lastY=lastY+delayspeed+c;}
  87. if (document.body.scrollTop+floatY<lastY) {lastY=lastY-delayspeed-c;}
  88. }
  89. document.all['floatlayer'].style.posLeft = lastX+'px';
  90. document.all['floatlayer'].style.posTop = lastY+'px';
  91. }
  92. setTimeout('adjust()',50);
  93. }
  94.  
  95. function define()
  96. {
  97. if ((NS4) || (NS6))
  98. {
  99. if (halign=="left") {floatX=ifloatX};
  100. if (halign=="right") {floatX=window.innerWidth-ifloatX-layerwidth-20};
  101. if (halign=="center") {floatX=Math.round((window.innerWidth-20)/2)-Math.round(layerwidth/2)};
  102. if (valign=="top") {floatY=ifloatY};
  103. if (valign=="bottom") {floatY=window.innerHeight-ifloatY-layerheight};
  104. if (valign=="center") {floatY=Math.round((window.innerHeight-20)/2)-Math.round(layerheight/2)};
  105. }
  106. if (IE4)
  107. {
  108. if (halign=="left") {floatX=ifloatX};
  109. if (halign=="right") {floatX=document.body.offsetWidth-ifloatX-layerwidth-20}
  110. if (halign=="center") {floatX=Math.round((document.body.offsetWidth-20)/2)-Math.round(layerwidth/2)}
  111. if (valign=="top") {floatY=ifloatY};
  112. if (valign=="bottom") {floatY=document.body.offsetHeight-ifloatY-layerheight}
  113. if (valign=="center") {floatY=Math.round((document.body.offsetHeight-20)/2)-Math.round(layerheight/2)}
  114. }
  115. }
  116. //-->
  117. </script>
  118. <!--This is where Part 1 of the FLOATING LAYER Script ends-->
  119. </head>
  120.  
  121. <body bgcolor="#706d66">
  122.  
  123.  
  124. <img src="graphics/oceania.gif" name="image1" width="1296" height="1387" border="0" usemap="#MainMapMap" id="image1" />
  125. <div id="content" onmousemove="positionElement('aj');">
  126.  
  127.     <!-- #### 3. Continent Specific #### --><!-- #### Change both the image source and the starting scroll position #### --></img>
  128.  
  129.     <map name="MainMapMap" id="MainMapMap">
  130.  
  131.     <script type="text/javascript">
  132.     <!--
  133.         setTimeout("alignMap()",1000);
  134.         setTimeout("alignMap()",2000);
  135.     //-->
  136.     </script>
  137.  
  138.  
  139.     <!-- #### 4. Ed codes here #### -->
  140.  
  141.     <area onmouseover="setTitle(this)" onmouseout="clearTitle(this)" shape="rect" coords="578,379,587,388" 
  142.         href="http://www.website.com.au" target="_blank" title="OUTBACK Park - Premium Outback Experience">
  143.  
  144.     <!-- #### 5. End of Ed's code #### -->
  145.  
  146. </map>
  147. <div id="aj" class="tooltip"> 
  148. </div>
  149.  
  150. <!--And here is Part 2 of our FLOATING LAYER Script-->
  151.  
  152. <script>
  153. if (NS4) {document.write('<'+'layer name="floatlayer" left="'+floatX+'" top="'+floatY+'">');}
  154. if ((IE4) || (NS6)) {document.write('<'+'div id="floatlayer" style="position:absolute; left:'+floatX+'px; top:'+floatY+'px;">');}
  155. </script>
  156. <form name=ee><input name=sd type=text style="color: white; background-color: #706d66" size="8"> 
  157. </input>
  158. </form>
  159.  
  160. <!--        Script by hscripts.com          -->
  161. <!--        copyright of HIOX INDIA         -->
  162. <!-- more scripts @ http://www.hscripts.com -->
  163.  
  164.  
  165. <script language=javascript>
  166. window.onload = init;
  167. function init() {
  168.   if (window.Event) {
  169.     document.captureEvents(Event.MOUSEMOVE);
  170.   }
  171.   document.onmousemove = getXY;
  172. }
  173.  
  174. function getXY(e) {
  175.   x = (window.Event) ? e.pageX : event.clientX;
  176.   y = (window.Event) ? e.pageY : event.clientY;
  177.  
  178.   document.ee.sd.value = x+":"+y;
  179. }
  180. </script>
  181. <script>
  182. if (NS4)
  183. {
  184. document.write('</LAYER>');
  185. }
  186. if ((IE4) || (NS6))
  187. {
  188. document.write('</DIV>');
  189. }
  190. ifloatX=floatX;
  191. ifloatY=floatY;
  192. define();
  193. window.onresize=define;
  194. lastX=-1;
  195. lastY=-1;
  196. adjust();
  197. </script>
  198.  
  199. <!--And this ends Part 2 of the FLOATING LAYER script-->
  200.  
  201.  
  202.  
  203. </body>
  204. </html>
  205.  
  206. <!--Here is where we position our map!-->
  207. <script>
  208. window.scrollTo(0,300);
  209. </script>
  210.  
Mar 20 '07 #1
2 5403
Head In A Pan
25 New Member
Hey?!
C'mon - surely someone else out there has encountered something similar with IE7... or is everyone here an Explorer secret agent/cult member? ;P

Please?
Mar 20 '07 #2
acoder
16,027 Recognized Expert Moderator MVP
See compatibiity tables for the browsers on mouse position.

Also, see this link.
Mar 20 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
7064
by: Gowhera Hussain | last post by:
Use This for Learning Only .... Do Not Try To Act Smart HACKING WITH JAVASCRIPT Dr_aMado Sun, 11 Apr 2004 16:40:13 UTC This tutorial is an overview of how javascript can be used to bypass simple/advanced html forms and how it can be used to override cookie/session
72
5189
by: Stephen Poley | last post by:
I have quite often (as have probably many of you) come across HTML forms with irritating bits of Javascript attached. The last straw on this particular camel's back was a large form I was asked to complete in connection with attendance at a seminar. After spending more than 15 minutes on it, I clicked on the submit button - and nothing happened. Looking round the pages on Javascript form validation that Google produced for me (well,...
6
2529
by: Andy Fish | last post by:
Hi, I want to use an anchor tag to invoke some javascript and I've read that it's bad form to use <a href="javascript:foo()"> I've read endless usenet posts and hint sites on the net, they all suggest different things and I can't get any kind of consistency, and I can't find any solution that works properly for IE, opera and mozilla. many of the recommended solutions go something like this:
53
5694
by: Cardman | last post by:
Greetings, I am trying to solve a problem that has been inflicting my self created Order Forms for a long time, where the problem is that as I cannot reproduce this error myself, then it is difficult to know what is going on. One of these Order Forms you can see here... http://www.cardman.co.uk/orderform.php3
15
3693
by: Mel | last post by:
if you know of dynamic expandable folder using CSS and display function, please drop me a note Yours, Mel
136
9314
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their code was littered with document.all and eval, for example, and I wanted to create a practical list of best practices that they could easily put to use. The above URL is version 1.0 (draft) that resulted. IMO, it is not a replacement for the FAQ,...
1
1276
by: Guadala Harry | last post by:
I have a very simple aspx page (no code-behind logic) that hosts two 3rd party controls (a dynamic menu and a calendar). The dynamic menu has the bare minimum number of properties set (declaratively), and the calendar has no properties explicitly set (declaratively or otherwise). These controls are placed on the aspx page declaratively. The point so far is that this is the absolute minimal aspx page with the simplest possible implementation...
1
1593
by: Neo Geshel | last post by:
I am having conflicting results with two pieces of identical code. One is an insert, the other is an update to a db. The first code, which works, is this: Sub Add3_Click(sender As Object, e As EventArgs) Dim imgStream as Stream = Add3Image.PostedFile.InputStream Dim imgLen as Integer = Add3Image.PostedFile.ContentLength Dim imgType as String = Add3Image.PostedFile.ContentType If Not imgStream Is Nothing And imgLen > 0 And (imgType =
12
8919
by: pantagruel | last post by:
Hi, I'm thinking of making a WScript based JavaScript library, I can think of some specific non-browser specific scripting examples that should probably make it in, like Crockford's little JavaScripter, can anyone think of anything else. Is anyone familiar with anything similar already done. Things that I am thinking that to provide are:
8
4927
by: GiJeet | last post by:
hello, is it possible to determine the browser and version using javascript at runtime and apply a browser specific external .css file? If so, I'd appreciate code sample so I can see how it's done. TIA G
0
8390
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8909
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8819
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8667
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4221
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4399
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.