473,387 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

spotlight problem in Firefox/Chrome

1
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 1924
acoder
16,027 Expert Mod 8TB
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.getElementById(...)
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
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...
3
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...
6
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...
3
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.....
4
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...
4
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...
21
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
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...
2
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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,...
0
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...

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.