We help IT Professionals succeed at work.
Get Started

highlight words within iframe webpage

josefkrzysztof
on
835 Views
Last Modified: 2012-05-06
Hi,

I would like to add anm input text and an input button to find and highlight words (simple or compung) inside the iframe placed webpage.

Very grateful for any help
The code:
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Example</title>
<style type="text/css">
</style>
<script type="text/javascript">
// <![CDATA[
 
window.onload = function()
	{
	var iframe_window = window.frames["my_iframe"];
	var iframe_body_html = iframe_window.document.getElementsByTagName("body")[0].innerHTML;
	//var html = http://virtual-economy.org.replace(/me/gi,"you"); //case-insensitive
	//var html = iframe_body_html.replace(/me/g,"you");
	//html = html.replace(/ME/g,"YOU");
	document.getElementById("output").innerHTML = html;
	}
 
// ]]>
</script>
</head>
<body>
 
<iframe name="my_iframe" id="my_iframe" width=500 height=500 src="http://virtual-economy.org"></iframe>
 
<div id="output"></div>
 
</body>
</html>

Open in new window

Comment
Watch Question
IT Expert
CERTIFIED EXPERT
Top Expert 2009
Commented:
This problem has been solved!
Unlock 1 Answer and 4 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE