Hey all,
I'm not sure if this is doable or not but here goes. I need a way to highlight a specific word(s) in Internet Explorer.
I know from looking at the IE Tool source that it's possible to access the text of the browser window, but here's the next step: I want to be able to either change the text color of a word(s) or maybe draw a semi-transparent window over it. In order to draw a window over it I would need to be able to determine the x,y location of the text wouldn't I?
Anyone have any idea some api commands I should look at or any other advice?
TIA
Highlight/mark text in browser
Highlight/mark text in browser
When all is said and done, more is said than done.
Here is an example of how to highlight text for IE (does not work with Mozilla/Firefox)
Online example:
http://www.penguinbyte.com/apps/pbwebst ... light.html
Online example:
http://www.penguinbyte.com/apps/pbwebst ... light.html
Code: Select all
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Highlight test</title>
<script language="JavaScript" type="text/javascript">
function HighlightText() {
var formInput = document.getElementById("highlight").value ;
var BodyHtml = document.getElementById("bodytext").innerText;
document.getElementById("bodytext").innerHTML = BodyHtml;
var RegText = new RegExp(formInput,"g")
var StyledText = "<span class='highlighter'>" + formInput + "</span>";
BodyHtml = BodyHtml.replace(RegText,StyledText);
document.getElementById("bodytext").innerHTML = BodyHtml
}
</script>
<style>
.highlighter {
color: #000000;
background-color: #ffff00
}
</style>
</head>
<body>
Enter text to highlight: <input name="highlight" type="text">
<input type="button" name="go" value="Go" onClick="HighlightText();">
<p> </p>
<div id="bodytext">PureBasic is a programming language based on
established BASIC rules. The key features of PureBasic are
portability (Windows, AmigaOS and Linux are currently fully supported),
the production of very fast and highly optimized executables and, of
course, the very simple BASIC syntax. PureBasic has been created for
the beginner and expert alike. We have put a lot of effort into its
realization to produce a fast, reliable and system friendly language.
</div>
</body>
</html>
-Beach
thank!
Hey guys thanks for the replies and info.
The highlighter code looks very interesting, I'll have to delve deeper into what it's doing.
So is it impossible to find the coordinates of a word in the browswer (x,y)?
Anyone?
The highlighter code looks very interesting, I'll have to delve deeper into what it's doing.
So is it impossible to find the coordinates of a word in the browswer (x,y)?
Anyone?
When all is said and done, more is said than done.