473,396 Members | 1,929 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,396 software developers and data experts.

javascript working fine in IE but cannot work in Firefox

Hi all,

I am new to javascript. I have this script working fine in IE but cannot work in firefox. Really appreciate on any guidance.

search0.js

Expand|Select|Wrap|Line Numbers
  1. function Search(str)
  2. {             
  3.       var textD=parent.textFrame.document;    
  4.       var SearchRange = textD.body.createTextRange();
  5.  
  6.       while(SearchRange.findText(str)){   
  7.         SearchRange.select();
  8.         var sr = textD.selection.createRange();
  9.         try {sr.pasteHTML( "<font style='background:yellow' id='highlightedText'>"+ str + "</font>");}      
  10.         catch (e) { alert(e.description);   }    
  11.         finally   { SearchRange.collapse(false); }
  12.       }
  13.       SearchRange.collapse(true);
  14. }
  15.  
  16. function makeArea(doc,map,cor,str)
  17. {    
  18.  
  19.    var replicator = document.createElement("AREA");
  20.    replicator.shape = "rect";
  21.    replicator.coords = cor;
  22.    replicator.alt=str;     
  23.    replicator.onclick=function (){Search(str)} ;
  24.    mapObj = doc.getElementById(map);
  25.    mapObj.appendChild(replicator); 
  26. }
  27.  
  28. function clearHighlite(){
  29.     parent.textFrame.location.reload(false);
  30. }
  31.  
the HTML file that called the script
[HTML]<html>
<title>Image</title>
<head>
<script language="JavaScript" src="Search0.js">

</script>

<script language="JavaScript" src="somedocument.txt"></script>

</head>

<body >
<button onclick="clearHighlite()">Clear Highlighting</button>
<img src="somedocument.bmp" usemap="#map" width=1000>

<map name="map" id="map">

<script language="JavaScript">
addAreas(document,"map")

</script>

</map>

</body>
</html>[/HTML]
May 21 '07 #1
1 1817
acoder
16,027 Expert Mod 8TB
This page should help.
Jan 29 '08 #2

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

Similar topics

5
by: LRW | last post by:
(Sorry if this is a repost...my newsreader keeps crashing on the posting--I don't know if the message going out or not) For some reason this javascript just won't work in Firefox. It works fine...
136
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...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
11
by: minnesotti | last post by:
Hi there, I subscribed to a photographic pictures-hosting website which is heavy on JavaScript. My preferred latest browser Mozilla Firefox does not work with it -- no pictures are displayed and...
27
by: Chris | last post by:
Hi, I have a form for uploading documents and inserting the data into a mysql db. I would like to validate the form. I have tried a couple of Javascript form validation functions, but it...
16
by: Eric | last post by:
I have a user of a web application written in Java/JSP that is unable to login to the site simply because certain links on the page do not run when they are clicked. Other popups using Javascript...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
2
by: Altman | last post by:
I have created an ascx control and I am calling registerclientscriptblock. The path to the js file is relative to the aspx page and not the ascx file. The function runs fine in IE7 but in...
6
by: ApOG | last post by:
Hello everyone, I have this javascript code working perfectly with IE, but with firefox nothing happens when running the function... function add_div_field () { var ni =...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.