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

Code works in IE but not in FF

Hi,

I have this piece of code which works in IE but not in FF. The code find all
words in actual page who correspond to str and highlight them.

Thanx for your help
<script language="JavaScript">

var win = window; // window to search.
var n = 0;

function findInPage(str) {
var txt, i, found;
var listEls = document.getElementsByTagName("span");

for (i = listEls.length - 1 ; i >= 0 ; i--) {
if (listEls[i].name == '__surligne__') {
var innerHTML = listEls[i].innerHTML;
listEls[i].outerHTML = innerHTML;
}
}

if (str == "")
return false;

txt = win.document.body.createTextRange();

while ( txt.findText(str) != false) {
txt.moveStart("character", -1);
txt.moveEnd("textedit");
txt.findText(str);
txt.pasteHTML('<span name="__surligne__" style="color:black;
background-color:yellow">' +str + '</span>');
}

return false;
}

</script>
Jul 23 '05 #1
1 1352
lolo wrote:
[...]
var innerHTML = listEls[i].innerHTML;
Assigning innerHTML to a variable name may make innerHTML unavailable.
listEls[i].outerHTML = innerHTML;


Firefox does not support outerHTML, it is an IE thing (and maybe Opera,
but don't quote me).

--
Rob
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Darren Grant | last post by:
Hi there, I've attempted to implement an Angle class. An Angle is a subset of an integer, where the range is [0,360). All other operations should be permitted. The code works, I think......
1
by: DiskMan | last post by:
System: Redhat 7.2 Kernel-2.6.11.8 GCC-3.4.3 CCC-6.5.9 Binutils-2.15 Make-3.80 GTK/GLIB-2.6.7 For some reason my Linux box is suddenly having issues trying to read ;
19
by: William Wisnieski | last post by:
Hello Everyone, I have a main form with a datasheet subform that I use to query by form. After the user selects two criteria on the main form and clicks the cmdShowResults button on the main...
192
by: Vortex Soft | last post by:
http://www.junglecreatures.com/ Try it and tell me what's happenning in the Microsoft Corporation. Notes: VB, C# are CLS compliant
6
by: Paolo Pignatelli | last post by:
I have an aspx code behind page that goes something like this in the HTML view: <asp:HyperLink id=HyperLink1 runat="server" NavigateUrl='<%#"mailto:" &amp;...
2
by: John | last post by:
I am having a weird error and maybe the synatax is different or something. I use a SQL Stored Proc and pass it one param and get a return to either a datareader or dataset. The code works fine for...
2
by: Enrique Bustamante | last post by:
Casting arrays that works on watch and command window but not in code. My application is casting arrays in a way it should work. To test if I was doing something invalid, I wrote a test code that...
1
by: Alex Clark | last post by:
Hi all, Apologies for the cross-post but I can't determine if this is a VS .NET problem or a VB.NET language issue. I'm using .NET 1.1 SP1, VS 2003 EA, VB.NET. I'm coding a custom component...
64
by: Bayazee | last post by:
hi can we hide a python code ? if i want to write a commercial software can i hide my source code from users access ? we can conver it to pyc but this file can decompiled ... so ...!! do you...
2
by: electroman | last post by:
Hello! I am having a very weird problem that I cant find any solution on the Internet (after so many years!). I am trying to code a C# program and I am using the WebBroswer control. The code is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.