473,734 Members | 2,693 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

spotlight problem in Firefox/Chrome

1 New Member
spotlight doesn't work in firefox and chrome...

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <title>Your title here</title>
  4.  
  5. <style type="text/css">
  6. <!--
  7. #content{
  8. position:absolute;top:0px;left:0px;text-align:center;
  9. layer-background-color:#ffffff;background:#ffffff;
  10. visibility:hide;visibility:hidden
  11. }
  12. #light{
  13. position:absolute;top:-130px;left:0px;z-index:500
  14. }
  15.  
  16. </style>
  17.  
  18. <script language="JavaScript">
  19.  
  20.  
  21. pre=new Image();
  22. pre.src="spotlight3.png";
  23. n4=(document.layers)?1:0;
  24. ie=(document.all)?1:0;
  25. d='document.';
  26. a=(n4)?'':'all.';
  27. s=(n4)?'':'.style';
  28. var y,x,c,l,h,w;
  29. enough=0;
  30. (n4)?window.captureEvents(Event.MOUSEMOVE):0;
  31. function Mouse(evnt){
  32. if (enough==0){
  33.  y=(n4)?evnt.pageY-pre.height/2:document.body.scrollTop+event.y-pre.height/2;
  34.  x=(n4)?evnt.pageX-pre.width/2:document.body.scrollLeft+event.x-pre.width/2;
  35.  searchlight();
  36.  }
  37. }
  38. (n4)?window.onMouseMove=Mouse:document.onmousemove=Mouse;
  39.  
  40. function searchlight(){
  41. c=eval(d+a+"content"+s);
  42. l=(n4)?eval(d+a+"content"+s+"."+d+a+"light"+s):eval(d+a+"light"+s);
  43. l.top=y;
  44. l.left=x;
  45. if (n4){
  46. c.clip.top=y;
  47. c.clip.right=l.left+pre.width;
  48. c.clip.bottom=l.top+pre.height;
  49. c.clip.left=x;
  50. }
  51. else c.clip="rect("+y+","+(x+pre.width)+","+(y+pre.height)+","+x+")";
  52. h=(n4)?window.innerHeight:document.body.clientHeight;
  53. w=(n4)?window.innerWidth:document.body.clientWidth;
  54. c.visibility=(n4)?"show":"visible";
  55. c.height=h;
  56. c.width=w;
  57. }
  58.  
  59. function reveal(){
  60. l.visibility=(n4)?'hide':'hidden';
  61. if (ie)document.body.style.cssText="overflow-x:hidden;overflow-y:scroll";
  62. document.bgColor=(n4)?c.bgColor:c.background;
  63. enough=1;
  64. update();
  65. }
  66.  
  67. function update(){
  68. if (n4){
  69. c.clip.top=0;c.clip.right=window.innerWidth;c.clip.bottom=window.innerHeight+window.pageYOffset;c.clip.left=0;
  70. }
  71. else
  72. c.clip="rect(0,"+document.body.clientWidth+","+(document.body.clientHeight+document.body.scrollTop)+",0)";
  73. setTimeout('update()',10);
  74. }
  75. document.write("</head><body bgcolor='#000000'><div id='content'>");
  76. //The image map is not necessary but it stops the dotted link line in IE!
  77. document.write("<div id='light'><img src="+pre.src+" useMap='#pic' border='0'>"
  78. +"<map name='pic'><area shape=CIRCLE coords=65,65,63 href='javascript:reveal()'></map></div>");
  79. if (ie) document.body.style.cssText="overflow-x:hidden;overflow-y:hidden";
  80. //-->
  81. </script>
  82.  
  83.  
  84.  
  85.  
  86. <p><font size="4">This is the spotlight effect. Use it on &quot;special&quot;
  87. pages, preferably containing only plain text and images. Do not use on complex
  88. pages.</font></p>
  89. <p><font size="4">Click anywhere on the page to turn the lights on!</font></p>
  90. <p><font size="4">This is the spotlight effect. Use it on &quot;special&quot;
  91. pages, preferably containing only plain text and images. Do not use on complex
  92. pages.</font></p>
  93. <p><font size="4">Click anywhere on the page to turn the lights on!</font></p>
  94. <p><font size="4">This is the spotlight effect. Use it on &quot;special&quot;
  95. pages, preferably containing only plain text and images. Do not use on complex
  96. pages.</font></p>
  97. <p><font size="4">Click anywhere on the page to turn the lights on!</font></p>
  98. <p>&nbsp;</p>
  99.  
  100. <p align="center"><img src="http://bytes.com/hallo.gif"></p>
  101.  
  102.  
  103.  
  104.  
  105.  
  106. <script language="JavaScript">
  107. <!--
  108. document.write("</div></body></html>");
  109. if (n4||ie)window.onresize=new Function("window.location.reload()");
  110. //-->
  111. </script>
Oct 12 '10 #1
1 1955
acoder
16,027 Recognized Expert Moderator MVP
The reason is that you're using very old code which was written for browsers that were first used over 10 years ago.

For starters, this code
Expand|Select|Wrap|Line Numbers
  1. n4=(document.layers)?1:0;
  2. ie=(document.all)?1:0;
  3. d='document.';
  4. a=(n4)?'':'all.';
should simply be document.getEle mentById(...)
I would suggest a rewrite or, if that's not possible, try to bring it up to modern standards by looking at cross-browser code.
Oct 12 '10 #2

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

Similar topics

5
2457
by: Paxton | last post by:
I created an html email containing a form whose method is POST. The form is posted to an asp page for processing, but no values are retrieved. So I response.write all the Request.Form fields, and nothing appears. I change the form's method to GET, then response.write the Request.QueryString items (which I can see in the URL) and it works fine. I need to use POST, as the quantity of data from the form will often exceed the limits of...
3
16196
by: milkyway | last post by:
Hello, I am working with an old Java Script code and have found the following but after putting in alerts I have found that insertRow doesn't work. What is the problem? TIA function addRowDOM (tableID) {
6
3572
by: Cliff R. | last post by:
Hi, I use a handy little Javascript Flash detection script on a number of sites (copied below). Usually works great, but I just started trying Firefox and it's not working. A few browsers are referenced in the script so I presume that Firefox needs to be added somewhere -- does anyone know how I could update this to be supported by Firefox? Thanks! <SCRIPT TYPE="text/JavaScript">
3
2956
by: niconedz | last post by:
Hi The following code works fine in IE but not Firefox. It's a little script that zooms an image and resizes the window to fit. Can anybody tell me what's wrong? Thanks Nico == btw.. sorry for the long post ==
4
5106
by: Joe | last post by:
Hello, I have created a login page using dotnet. I am using requiredFieldValidator and noticed that the code works fine in IE but not in Netscape, Opera, Mozilla, Firefox, etc. For example if I do not enter anything in the form in IE, then form won't be submitted but in other browsers it is submitted. I checked that JavaScript is enabled in Netscape, Opera, Mozilla, Firefox,
4
3407
by: bbp | last post by:
Hello, In an ASPX page I have a "Quit" button which make a simple redirect in code-behind. This button doesn't work no more since (I think) I moved from the framework 1.0 to 1.1 and it doesn't work only on IE! My ASPX page works in FireFox. If the button doesn't work it's because of validators (and it worked with the same code in v1.0).
21
11405
by: briggs | last post by:
<html> <head> <script> /* AddChild */ function ac() { var c; var p = document.getElementById("p"); for (var i = 0; i < 5; i++) { c = document.createElement("DIV"); // Create 'div' element.
23
5379
by: wylbur37 | last post by:
I'm running an Apache server on my own computer (Windows XP Pro). I wrote a simple PHP script (called test3.php) that I'm running by putting the following URL in the address bar of the browser (Firefox) .... http://localhost/test3.php The script generates the following link using the echo statement ...
2
1513
bilibytes
by: bilibytes | last post by:
Hi, i have been creating an ajax aplication on my website and it worked as i expected it to work on Safari and Firefox, until i upgraded to Firefox 3. It doesn't work either on windows. the url is: http://www.whichselect.com I have created an event, that was triggered onmouseover the horizontal nav bar
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9449
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
9310
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
9182
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
6735
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
6031
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
4550
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...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2180
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.