javascript working fine in IE but cannot work in Firefox

This is a discussion on "javascript working fine in IE but cannot work in Firefox" within the JavaScript Forum section. This forum, and the thread "javascript working fine in IE but cannot work in Firefox are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old May 21st, 2007, 17:37
New Member
Join Date: May 2007
Location: US
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
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
Code: Select all
function Search(str)
{             
      var textD=parent.textFrame.document;    
      var SearchRange = textD.body.createTextRange();
     
      while(SearchRange.findText(str)){   
        SearchRange.select();
        var sr = textD.selection.createRange();
        try {sr.pasteHTML( "<font style='background:yellow' id='highlightedText'>"+ str + "</font>");}      
        catch (e) { alert(e.description);   }    
        finally   { SearchRange.collapse(false); }
      }
      SearchRange.collapse(true);
}

function makeArea(doc,map,cor,str)
{    

   var replicator = document.createElement("AREA");
   replicator.shape = "rect";
   replicator.coords = cor;
   replicator.alt=str;     
   replicator.onclick=function (){Search(str)} ;
   mapObj = doc.getElementById(map);
   mapObj.appendChild(replicator); 
}

function clearHighlite(){
    parent.textFrame.location.reload(false);
}
the HTML file that called the script

Code: Select all
<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>

Last edited by Lchad; May 21st, 2007 at 19:02. Reason: added code tags
Reply With Quote

Reply

Tags
javascript, firefox

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Links not working in IE but work in FireFox/Safari skuliaxe Web Page Design 2 Mar 17th, 2008 15:52
Flash content resets, when javascript hide / show is used (prob in firefox, IE fine) call14 Flash & Multimedia Forum 0 Feb 4th, 2008 16:12
Some javascript not working in Firefox jonnymorris Web Page Design 4 Sep 18th, 2007 14:02
Some javascript not working in Firefox jonnymorris JavaScript Forum 4 Sep 18th, 2007 10:47
Unable to disable text(label) in javascript,working fine with IE, not with MOZILLA balaji JavaScript Forum 1 Jul 11th, 2007 09:55


All times are GMT. The time now is 23:52.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43